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
More Related Contents:
- Calling async method synchronously
- Serializing a list to JSON
- CryptographicException: Padding is invalid and cannot be removed and Validation of viewstate MAC failed
- Are static methods thread safe
- prevent property from being serialized in web API
- Resizing an image in asp.net without losing the image quality
- Convert from binary data to an image control in ASP.NET
- Passing array of strings to webmethod with variable number of arguments using jQuery AJAX
- What is the best approach to handle session timeouts in asp.net
- How to make LINQ execute a (SQL) LIKE range search
- How to debug a single thread in Visual Studio?
- How can I get date and time formats based on Culture Info?
- ConfigurationManager.AppSettings getting null?
- MEF with MVC 4 or 5 – Pluggable Architecture (2014)
- Multiples Table in DataReader
- Redirect to another page when user is not authorized in asp.net mvc3
- ThreadStaticAttribute in ASP.NET
- Detect Browser Close on Asp.net
- No IUserTokenProvider is registered
- AutoMapper Migrating from static API
- Download file with ClosedXML
- Making an entire row clickable in a gridview
- Datetime format Issue: String was not recognized as a valid DateTime
- Limit only one session per user in ASP.NET
- Explicit construction of entity type [MyClass] in query is not allowed
- Web Service without adding a reference?
- How to maintain the value of label after postback in Asp.net? [closed]
- difference between http.context.user and thread.currentprincipal and when to use them?
- How do I call a method in a Master Page from a content’s code-behind page?
- Why are Static Methods not Usable as Web Service Operations in ASMX Web Services?