是否可以在asp request.servervariables后面的代码中清除request.servervariables中设置的值。我正在尝试注销模块,因为一旦我单击“注销”按钮,我将重定向到“注销”页面,而在“页面处理”方法中,我将清除所有会话,但“清除会话”没有清除Request.ServerVariable["User"]中设置的值。
protected void Page_Load(object sender, EventArgs e)
{
Session.Clear();
Session.RemoveAll();
Session.Abandon();
HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
}发布于 2015-05-27 06:15:49
使用下列代码:-
Request.Params.Clear();
如果要根据类型删除服务器变量数据,请使用此数据
Request.ServerVariables"variableName".Remove(0);
它将删除此字符串中的所有字符。
https://stackoverflow.com/questions/30474211
复制相似问题