c# - 在 asp.net 中使用 c# 进行 session 管理

标签 c# asp.net c#-4.0

我想在 asp.net 应用程序中进行 session 管理,所以每当我注销时,我的其他 aspx 页面都无法打开。

请告诉我简单的方法。

我是 c# 和 Asp.net 的新手,所以请忽略我的提问方式。

最佳答案

当用户注销时。 做以下

Session.Clear();
Session.Abandon();

在母版页(或所有其他需要限制的页面)上,勾选

If (Session["sessionname"] == null)
{
Respones.Redirect("MyTimeOutPage.aspx");
}

-温和

关于c# - 在 asp.net 中使用 c# 进行 session 管理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12595918/

相关文章:

c# - 使用文件选择器 Metro 应用程序选择所有文件 Windows 8

asp.net - asp.net中如何显示警告框

c# - 我的 Web API 服务需要访问 token 吗?

c# - orderby 语句使用 First() 方法调用,为什么需要它?

c# - 如何防止输出参数以 WCF Web 服务中的返回参数结束?

c# - 对象池框架

c# - DryIoC - 在解析时指定一些构造函数参数

c# - 带有 "validateAllProperties"的 Validator.ValidateObject 在第一次错误时真正停止

c# - 使用 C# 将字节转换为图像时出现 "parameter is not valid"

asp.net - Sitecore:Sitecore.Web.WebUtil.Redirect 相对于 Response.Redirect 有何优势?