Getting only the Referrer page not complete address in .NET

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

private void Page_Load(object sender, System.EventArgs e)
    string str = Request.UrlReferrer.ToString();   
    Label1.Text = str;  

The result in Label1.Text is http://localhost:82/data/WebForm1.aspx.

Now I want the result "WebForm1.aspx" in Label1.Text

can you please help me?



If you want only the part after the last / in the URL, calling the System.IO.Path.GetFileName() method on the Uri.LocalPath should do the trick:


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


Need Your Help

Using Autolayout constraints from Storyboard in UICollectionViewCell

ios swift autolayout uicollectionview uicollectionviewcell

I'm using a custom UICollectionViewCell class for my UICollectionView. I have to use addSubview in my custom class because I'm using FirebaseUI-iOS. This is what my MessageCollectionViewCell looks ...

How to get and cancel a PendingIntent?

android android-intent alarmmanager android-pendingintent

I have an alarmManager which I am using to send notifications to the user at specific times. Since there are multiple alarms, I have multiple pending intents that I am creating and giving a unique...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.