Request source in asp.net/C#

Basically, I need to know the answer to this question in asp.net/C#:
source of REQUEST
I would like one of my pages to find out which page points the user to this particular page. I tried going through intellisense on several page properties, but could not find it. Any help?

+7
source share
5 answers

It looks like you are looking for Request.UrlReferrer

Documentation: HttpRequest.UrlReferrer

The request can be fulfilled on the page:

 Page.Request 

If the page instance is not available, you can get it from the current context using:

 HttpContext.Current.Request 
+14
source

You are looking for the Request.UrlReferrer property.

+3
source

You can look at Request.ServerVariables("HTTP_REFERER") or Request.ServerVariables("URL") .

Or you can use the query object as follows:

Request.Url.ToString() provides the full path to the calling page.

If you call this in the Immediate window without ToString, , you can see a lot of information:

 Request.UrlReferrer.ToString() 
+3
source

I think you want Request.ServerVariables["HTTP_REFERER"];

EDIT:

Use @SLaks answer

0
source

We can find out the Url referral from the UrlReferrer property. It is easily processed in the global.asax file.

 protected void Session_Start() { var SourceURL = HttpContext.Current.Request.UrlReferrer.AbsoluteUri.ToString(); } 

Now we can save this value in a session or somewhere and perform any operation that we would like.

0
source

All Articles