Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

Here's a simpler solution:

var uri = new Uri("http://www.example.com/mypage.aspx?myvalue1=hello&myvalue2=goodbye"); string path = uri.GetLeftPart(UriPartial.Path); 

Borrowed from here: Truncating Query String & Returning Clean URL C# ASP.netTruncating Query String & Returning Clean URL C# ASP.net

Here's a simpler solution:

var uri = new Uri("http://www.example.com/mypage.aspx?myvalue1=hello&myvalue2=goodbye"); string path = uri.GetLeftPart(UriPartial.Path); 

Borrowed from here: Truncating Query String & Returning Clean URL C# ASP.net

Here's a simpler solution:

var uri = new Uri("http://www.example.com/mypage.aspx?myvalue1=hello&myvalue2=goodbye"); string path = uri.GetLeftPart(UriPartial.Path); 

Borrowed from here: Truncating Query String & Returning Clean URL C# ASP.net

example domain
Source Link
unor
  • 97.7k
  • 29
  • 234
  • 391

Here's a simpler solution:

var uri = new Uri("http://www.somesiteexample.com/mypage.aspx?myvalue1=hello&myvalue2=goodbye"); string path = uri.GetLeftPart(UriPartial.Path); 

Borrowed from here: Truncating Query String & Returning Clean URL C# ASP.net

Here's a simpler solution:

var uri = new Uri("http://www.somesite.com/mypage.aspx?myvalue1=hello&myvalue2=goodbye"); string path = uri.GetLeftPart(UriPartial.Path); 

Borrowed from here: Truncating Query String & Returning Clean URL C# ASP.net

Here's a simpler solution:

var uri = new Uri("http://www.example.com/mypage.aspx?myvalue1=hello&myvalue2=goodbye"); string path = uri.GetLeftPart(UriPartial.Path); 

Borrowed from here: Truncating Query String & Returning Clean URL C# ASP.net

Source Link
Johnny Oshika
  • 58k
  • 41
  • 197
  • 286

Here's a simpler solution:

var uri = new Uri("http://www.somesite.com/mypage.aspx?myvalue1=hello&myvalue2=goodbye"); string path = uri.GetLeftPart(UriPartial.Path); 

Borrowed from here: Truncating Query String & Returning Clean URL C# ASP.net