Remove QueryString value using Asp.net

To clear all query strings, you can invoke the Request.QueryString.Clear();
which will remove all the querystrings at the url
To remove a specific querystring invoke Request.QueryString.Remove("name of the querystring").

Please follow below Example


PropertyInfo isreadonly = typeof(System.Collections.Specialized.NameValueCollection).GetProperty("IsReadOnly", BindingFlags.Instance | BindingFlags.NonPublic);
            // make collection editable
            isreadonly.SetValue(this.Request.QueryString, false, null);
            // remove
            this.Request.QueryString.Remove("op");

Comments