Referring URL\VB

  • Thread starter Thread starter George
  • Start date Start date
G

George

VS.NET 2002\Web\VB

I am trying to get the referring URL for one of my pages using this:

Request.UrlReferrer.ToString

Page 1 has a link to Page 2. I click on the link in Page 1, and go to Page
2. Page 2 is where I am trying to get the referring URL. However, instead of
getting the URL of Page 1 (the referring page), I get the URL of the Page 2
(the current page), instead.

Am I not using that right?

Thanks,
George
 
Also, I might add, that Page 1 (the referrer) is an .htm page, and Page 2 is
an .aspx page.
 
Do you have any postbacks. You should check the postback before you store
the Referrer or else the page will refer back to itself since it is posting
back to itself.

If you do you can save the referrer the first time the page loads in the
viewstate of the page as follows:
If Not IsPostback then
Viewstate("ReferrerURL") = Request.UrlReferrer.ToString()
End If
 
Hey Gary,

That is exactly what was happening! I now have it working.

Thanks for your help.
George
 
Back
Top