Friday, 11 January 2013

Get URL of the Referring Page Dynamically

Get URL of the Referring Page Dynamically

Here is the Code Snippet to get the Url of the Referring Page:

System.Uri url = Context.Request.UrlReferrer;
string RefURL = url.AbsoluteUri.ToString();

lblURL.Text = RefURL;

Note: InCase If the Referring Page is using  URL Rewriting to alter the structure of the URL; Even then we can get the original Url as follows:

string url= Request.Url.GetLeftPart(UriPartial.Authority)+Request.RawUrl;

lblURL.Text =url;

Refer this for more details:

No comments:

Post a Comment

Thank You for Your Comments. We will get back to you soon.

back to top