Originating Url

Discussion in 'ASP.NET / ASP.NET Core' started by Swood, Jul 11, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Can I determine which Url a users browser was pointing to prior to loading my page?
     
  2. 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
     
  3. Thanks

    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">
     
  4. I can't get these tp work?
    I always get my own URL for my website never the reffering URL?

    Thank you
    Tony
     
  5. 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

    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">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page