一段时间后网站注销? [英] Website Logout after some time?

查看:165
本文介绍了一段时间后网站注销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我使用工具控件中的登录控件和注销控件.
用户登录并在站点中工作,然后它会自动注销.

我的登录代码


I use login control and logout control from tool control.when
user login and working in site then it automatically logout.

my login code

SqlParameter[] paramater = new SqlParameter[]
              {                              
                  new SqlParameter("@User_Name",Login1.UserName),
                  new SqlParameter("@Password",Login1.Password)                               
              };
            SqlDataReader dr = (SqlDataReader)db.ExecuteReader("Login", paramater);
            if (dr.HasRows)
            {
             FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false);
             Response.Redirect(@"~/Home.aspx", false);
            }


在网络配置中


In web config

<authentication mode="Forms">
<forms loginUrl="~/LogIn.aspx" protection="All" slidingExpiration="true" timeout="2880"</authentication>


在母版页


At masterpage

protected void Page_Load(object sender, EventArgs e)
   {       
       if (!HttpContext.Current.User.Identity.IsAuthenticated)
       {
          Response.Redirect("~/LogIn.aspx");
       }
}
protected void HeadLoginStatus_LoggedOut(object sender, EventArgs e)
    {
        FormsAuthentication.SignOut();
 Response.Redirect(@"~/Login.aspx", false);
    }


请帮助它解决紧急问题,我无法解决..检查是否写入..


pls help its urgent and i cant solve it..check is it write or not..

推荐答案

您必须使用会话超时来执行此操作.检查
此处 [
You have to use Session Timeout to do this. Check
here[^]


这篇关于一段时间后网站注销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆