How to get a url of Page from where you Redirected to current page in asp.net with C#

Description:-



Here i want to get the full path of the page from where it is redirected in other words i want to get URL of the source page from where it is redirected



Code in C# :-


string s=Request.ServerVariables["HTTP_REFERER"]; 

                     
Above code will return Full Path of the Source Page, but if you want only the Page Name from where you Redirected then here is the code for you :- 

Request.ServerVariables["HTTP_REFERER"].Substring(Request.ServerVariables["HTTP
_REFERER"].LastIndexOf("/") + 1); 

Post a Comment