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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top