tags:

views:

361

answers:

4

Is it possible get the last visited pages by user using C# / ASP.NET (without using javascript)

+4  A: 

You can get in some cases the page from which the user came with Referer.

Sani Huttunen
Note that referrer is not reliable. It is an optional header, not always sent.
John Saunders
Hence I wrote "in some cases"...
Sani Huttunen
A: 

The last visited pages on your site: Yes, you can keep track of that.
Last visited pages anywhere: No, common browsers do not send this information (except maybe the last url as referer header) to the server and therefore it's not available in your asp.net application.

VolkerK
How would you keep track of last visited pages on your site. Maybe that's what he wants to know.
John Saunders
A: 

You can use the cookie help to find latest visited page. Each and every page load event u can overwrite the cookie value but its not good for performance. Referrer is the best option to use this case.

Kthevar
+1  A: 

this may be what you are looking for. This will add the last page's url to a string.

[ C# ]

string MyReferrer = Request.UrlReferrer.ToString();

[ VB.NET ]

Dim MyReferrer As String = Request.UrlReferrer.ToString()