你好
我如何在我的页面上实现注销功能,以便将用户重定向到新页面并且不允许查看上一页。
请您参考如下方法:
if (SessionConfig.Current.UserType != null)
Response.Redirect("~/Logout.aspx?UserType=" + SessionConfig.Current.UserType,false);
else
Response.Redirect("~/Default.aspx",false);
其中 sessionconfig 是一个已经声明的 session 变量。
public static SessionConfig Current
{
get
{
SessionConfig session =
(SessionConfig)HttpContext.Current.Session["__SessionConfig__"];
if (session == null)
{
session = new SessionConfig();
HttpContext.Current.Session["__SessionConfig__"] = session;
}
return session;
}
}
只需将其放入按钮单击事件中,然后在 homepage.aspx 中更改为您的主页。它将重定向页面,您看不到旧页面
