Hi All,
How can I get previous URL in a page. I need to clear my session/Cookies when the previous URL is not mine. In the below example assume gmail is an my own website(URL/Application)

  1. Go to www.gmail.com login and arrives at inbox page
  2. while it is still in gmail web site, in the URL type in: www.yahoo.com open the yaho page.
  3. Then type URL in: www.gmail.com and found member is still logged in. its goes to inbox, in this case need to clear my session. Any one give idea how can i get previous URL in the particular page?

Note: Need to be maintain the state when using same URL like as www.gmail.com instead of www.yahoo.com

Thanks in advanced !


you can check the previous url using HTTP_Referer, You can get the current domain name by using Request.ServerVariables("server_name")