首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ASP中的Request.ServerVariables .NET C#

ASP中的Request.ServerVariables .NET C#
EN

Stack Overflow用户
提问于 2015-05-27 05:55:25
回答 1查看 1.2K关注 0票数 0

是否可以在asp request.servervariables后面的代码中清除request.servervariables中设置的值。我正在尝试注销模块,因为一旦我单击“注销”按钮,我将重定向到“注销”页面,而在“页面处理”方法中,我将清除所有会话,但“清除会话”没有清除Request.ServerVariable["User"]中设置的值。

代码语言:javascript
复制
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();

    }
EN

回答 1

Stack Overflow用户

发布于 2015-05-27 06:15:49

使用下列代码:-

Request.Params.Clear();

如果要根据类型删除服务器变量数据,请使用此数据

Request.ServerVariables"variableName".Remove(0);

它将删除此字符串中的所有字符。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30474211

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档