1

你好

如何在我的页面上实现注销功能,以便用户被重定向到新页面并且不允许查看上一页。

4

4 回答 4

3
  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 中更改为您的主页。它将重定向页面,您看不到旧页面

于 2010-11-13T09:43:16.600 回答
1

只需添加 LogoutAction="RedirectToLoginPage"到登录控件,它将解决您的问题。

希望这可以帮助

于 2012-05-25T21:10:07.893 回答
0

如果您希望不允许用户返回上一页,请查看ASP.net登录控件,请参阅 此主题

于 2010-11-13T09:38:16.330 回答
0

首先,启用 asp.net 安全权限并将匿名用户访问设置为拒绝。然后,使用 asp.net 登录控件并根据需要进行设置...

于 2010-11-13T09:55:07.603 回答