-
Aug 12th, 2008, 10:05 AM
#1
Thread Starter
Hyperactive Member
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
-
Aug 12th, 2008, 10:09 AM
#2
Frenzied Member
Re: Get Refered URL - something like Http_referrer in classic asp
-
Aug 12th, 2008, 10:22 AM
#3
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.
-
Aug 12th, 2008, 01:54 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|