string a = Request.QueryString["INDXXX"];
RemoveQueryString("INDXXX");//清掉传过来的querystring值
public void RemoveQueryString(string stname)
{
EnableQueryStringWriting();
Request.QueryString.Remove(stname);
}
public void EnableQueryStringWriting()
{
var qs = Request.QueryString;
var queryString = (NameValueCollection)Request.GetType().GetField(
"_queryString",
BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Request);
PropertyInfo readOnlyInfo = queryString.GetType().GetProperty(
"IsReadOnly",
BindingFlags.NonPublic | BindingFlags.Instance
);
readOnlyInfo.SetValue(queryString, false, null);
}
1
最新推荐文章于 2024-07-20 07:45:00 发布