你好
如何在我的页面上实现注销功能,以便用户被重定向到新页面并且不允许查看上一页。
if (SessionConfig.Current.UserType != null)
Response.Redirect("~/Logout.aspx?UserType=" + SessionConfig.Current.UserType,false);
else
Response.Redirect("~/Default.aspx",false);
其中 sessionconfig 是已经声明的会话变量。
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 中更改为您的主页。它将重定向页面,您看不到旧页面
只需添加 LogoutAction="RedirectToLoginPage"
到登录控件,它将解决您的问题。
希望这可以帮助
首先,启用 asp.net 安全权限并将匿名用户访问设置为拒绝。然后,使用 asp.net 登录控件并根据需要进行设置...