c# - Getting only the Referrer page not complete address in .NET -


I am using C #. Below is my sample code.

  Private Zero Page_load (Object Sender, System.EventArgs e) {string str = Request.UrlReferrer.ToString (); Label1.Text = str;  

The result is Label1.Text .

Thank you

If you want only one part after the last / in the URL, then the call should be done by calling the method:

  System.IO.Path. GetFileName (Request.UrlReferrer.LocalPath);  

If you want output to keep query string information from URI, use the property:

  System.IO.Path.GetFileName (Request.UrlReferrer .PathAndQuery);  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -