I have an url like localhost:8001/?page=categories&catid=4&p=1888&country=1,2,3,6 and I want to remove &p=1888 part with regular expression. How can I match & exclude this part with asp.net c#?
Edit: Here is the function I've created for solution:
public string RemoveUrlParameters(HttpContext Context, string[] Parameters)
{
string result = String.Empty;
UriBuilder urlBuilder = new UriBuilder(Context.Request.Url.AbsoluteUri);
var values = HttpUtility.ParseQueryString(urlBuilder.Query);
for (int i = 0; i < Parameters.Length; i++)
values.Remove(Parameters[i]);
urlBuilder.Query = values.ToString();
result = urlBuilder.ToString();
result = Context.Server.UrlDecode(
result.Replace("http://" + Context.Request.Url.Authority, String.Empty)
.Replace(":80", String.Empty).Replace("default.aspx", String.Empty));
return result;
}