[SOLVED] WebBrowser return the redirected URL

Answered
0
0

Hello WiseJ team,

i want to know if there a possibility to get the redirected url from a WebBrowser Control?

For example: the initial Uri was: http://example.com and after the load this site, it do a redirect to http://newWebSite.com, there is some way to get the new url, because i saw that the Url of the WebBrowser control does not change after the redirection?

Thanks, Best.

  • You must to post comments
Best Answer
0
0

Hi,

this might depend on how the redirection is done.
I just tried here with 2 local htm files and a redirection via meta refresh tag.
In that case I get 2 DocumentCompleted events, one for the original and one for the redirected url.

Maybe this also works in your environment ?
Find a simple example attached.

Best regards
Frank

Attachment
  • Megasp Software
    Hi Frank Thanks for the reply. I already use the DocumentCompleted events and intercept the 2 loads, first of the url that i call and second of the redirected url, but in the second case (redirected page) the Url from WebBrowserDocumentCompletedEventArgs and WebBrowser are the same of the initial call, it does not change. If i try in the browser i got the correct final url, if i look at network log (browser) it shows the correct url of the redirect but the in the application the url remain same that i set. I do not know how the redirect was done, because i call an external url where if there was some error on proccessing it redirect to the final url, all this urls are external of the project and different domains.
  • Frank (ITG)
    Can you please send me the URL to frankATiceteagroup.com ? I´ll check if there is an alternative solution. TIA, Frank
  • Megasp Software
    Hi frank, can you rewrite the email because it is not very clear? Thanks
  • Frank (ITG)
    Just replace AT with @ and it should work. This is to avoid spam. TIA Frank
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.