Referring URL\VB

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
 
G

George

Also, I might add, that Page 1 (the referrer) is an .htm page, and Page 2 is
an .aspx page.
 
G

gary Vidal

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
 
G

George

Hey Gary,

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

Thanks for your help.
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top