Get Refered URL - something like Http_referrer in classic asp-VBForums
Results 1 to 4 of 4

Thread: Get Refered URL - something like Http_referrer in classic asp

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Location
    fgh
    Posts
    332

    Get Refered URL - something like Http_referrer in classic asp

    Hello,

    My application has three aspx pages. page1.aspx , page2.aspx , page3.aspx

    from page1.aspx i am redirecting to page2.aspx?Name=abcd,phone=123

    now there is a button in page2.aspx which redirects to page3.aspx. In page3.aspx i need to get the URL information of refered page, i.e.,
    "page2.aspx?name=abcd,phone=123" in page3.aspx ....

    how i can get this done in asp.net ... there is something like http_referer (server variable) in classic asp but it get information if it is click from a link only, not on redirect (information from w3schools.com)


    thankzzzz
    gh

  2. #2
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Get Refered URL - something like Http_referrer in classic asp

    request.UrlReferrer

  3. #3
    Hyperactive Member
    Join Date
    Jan 2008
    Location
    Merseyside
    Posts
    456

    Re: Get Refered URL - something like Http_referrer in classic asp

    You can also get it by accessing the HTTP_REFERER in the Request Parameters collection.

    Code:
    Request.Params.Item("HTTP_REFERER")
    Though request.UrlReferrer mentioned by Besoup is easier.

  4. #4
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: Get Refered URL - something like Http_referrer in classic asp

    Not necessarily. A response.redirect does not guarantee that you will receive an HTTP_REFERER each time. The guaranteed way is through clicking a link. A Response.Redirect sends an HTTP 301 to the browser, which in turn then requests the page sent in the HTTP 301 header. The browser may or may not set the headers and if you test this out (well, when I tested this anyways), you will see that the header is not always available.

    I'd suggest that if you do have a bit of codebehind on each page which causes a Response.Redirect, then you do have control over where it goes and so you can append the querystring parameters that you need yourself.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.