WebBrowser object and redirects

  • Thread starter Thread starter ewahl
  • Start date Start date
E

ewahl

Hi folks,

I have searched for an answer to this question on the internet, but
been unable to find it so far. I am hoping somebody can help me out.
When you are using a WebBrowser object in .Net 2.0, is there any way
that you can intercept when the server you are pointing to issues a
Response.Redirect. That is, I can handle the Navigating and Navigated
events, but the first only gets called before the initial page is
called, and the second only gets called when the final, redirected-to
page, is loaded. I can't find any way of capturing the redirect itself
and doing something at that point. (I hope that was clear.) Can anybody
tell me if it's possible to intercept the redirect, and if so, how?
Thanks much in advance.

-Eric
 
Response.Redirect is done on the client side overall. The server sends an
"instant" redirect command and the client obeys. Can you capture the event?
There are a couple of ways, depending on your needs. One of the easiest is to
redirect with a command line variable (QueryString) and use that var to
realize it has been redirected. Another is to hang something in session that
a redirect happened. But, you cannot simply figure it out, as the server sees
the redirected hit just like any other hit to the site. As web servers are
stateless, you have to persist the fact a redirect was requested.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
That sounds like a way to handle redirects from the server side, but I
need to do something on the client side. If the server sends a
redirect, I want to be able to add some information to the querystring
before the redirect actually happens. But, this needs to happen on the
client side. (Assume that I have no control over what the server code
does, that I am simply fulfilling a requirement that I have for
client-side behavior.) Is there any way to do that? I realize this is
not standard behavior for a "regular" web browser, but I am trying to
emulate something that a third-party piece of hardware (that can web
browse) might do. Thanks.

-Eric
 
Back
Top