Search This Blog

Monday, November 16, 2015

How to clear the querystring From Url

// Get the NameValueCollection 
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("YourQueryStringParameter"); 

Don't forget to add following Using Statement 

using System.Collections; 
using System.Reflection; 

No comments:

Post a Comment