PDA

View Full Version : Originating Url


Swood
07-11-2004, 01:51 AM
Can I determine which Url a users browser was pointing to prior to loading my page?

Scott
07-11-2004, 03:04 AM
In your Page_Init, Page_Load or other event code you can use:

"Request.Url.ToString" to get the url of the request, or

"Request.UrlReferrer.ToString" to get the url of the referring page

Swood
07-11-2004, 06:16 AM
Thanks

[b]quote:Originally posted by Scott

In your Page_Init, Page_Load or other event code you can use:

"Request.Url.ToString" to get the url of the request, or

"Request.UrlReferrer.ToString" to get the url of the referring page

</blockquote id="quote"></font id="quote">

TonyMast
08-03-2004, 10:58 AM
I can't get these tp work?
I always get my own URL for my website never the reffering URL?

Thank you
Tony

Scott
08-04-2004, 10:02 AM
If someone reaches your page by typing the url into their browser's address line there will be no referring url, but if the page is reached by a link from another site, you should be able to get the referring url.

If the referring page is on your own website then then Request.UrlReferrer should return a reference to that page.

Note that to prevent an exception from being thrown when your page url is typed into thge address bar you need to test for a referring url, i.e.:

if Request.UrlReferrer is nothing then
...
else
... Request.UrlReferrer.ToString ...
end if

[b]quote:Originally posted by TonyMast

I can't get these tp work?
I always get my own URL for my website never the reffering URL?

Thank you
Tony
</blockquote id="quote"></font id="quote">