I need to find out from which page the request is coming from. For instance I have a button in page A and when clicked it redirects as follows
http://...../ClientName/names.aspx?nameId=4,
Page A’s
URL = "http://...../Maintenance/names.aspx?nameId=4"
In page B, I want to be able to determine if it’s coming from Page A. Notice that Page A and Page B have the same ending but in different folders… How can I know in page B if it’s coming from the names.aspx in folder Maintenance?
Thank you
One hint: The URL Referrer is sent by the Browser (Request header). But this is not reliable, since (for instance) security tools might remove it from the request, as do some Proxies. I have used the same concept years back, but later failed because of this reason.
Example: http://darklaunch.com/2011/05/07/chrome-disable-referer-headers
On the other hand, if you can rely on the referrer – e.g. because you are in an Intranet, go ahead – as FT / Kuru said use
HttpContext.Current.Request.UrlReferrer. Very easy to use.We have later solved this on application level: