protected void Page_Load(object sender, EventArgs e)
{
string currentUrl = "http://localhost:39211/?page=2&sort=1&link=12&category=papers";
string result = RemoveQueryString(currentUrl, "link");
Response.Write(result);
}
public string RemoveQueryString(string url, string key)
{
string pattern = key + "=[^&]+&?";
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(pattern);
return regex.Replace(url, "");
}
Wednesday, June 5, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment