2013-02-28 136 views
1

我的网站应用程序注销每一分钟,.aspxauth cookie设置为(20天)和asp.net_sessionid设置为(会话结束),我想让我的网站(记住我)。登录表单asp.net

我使用下面的代码 - 但没有利用 - :

<authentication mode="Forms"> 
    <forms 
    loginUrl="~/Account/Login.aspx" 
    protection="All" 
    timeout="30160" 
    name=".ASPXAUTH" 
    path="/" 
    requireSSL="false" 
    slidingExpiration="false" 
    defaultUrl="~/Default.aspx" 
    cookieless="UseCookies" 
    enableCrossAppRedirects="false" /> 
</authentication> 

如何防止经常登出我的应用程序?

+1

我发现[这](http://stackoverflow.com/questions/3355601/asp-net-remember -me-cookie)和[this](http://stackoverflow.com/questions/2452656/asp-net-mvc-rememberme)搜索。 – Brian 2013-02-28 20:54:56

+0

非常感谢你:)!我在[post](http://stackoverflow.com/a/3175994/1525791)中找到了解决方案, – DreamsDotNet 2013-03-03 00:42:39

回答

2

看起来所有东西都是默认设置,所以请使用以下设置。

<forms loginUrl="~/Account/Login.aspx"" timeout="30160" /> 

在web.config中,确保sessionState要么根本不存在,或者设置的东西。

<sessionState timeout="20"/> 

如果你修改了默认形式的认证,看到这个帖子 -

Forms Authentication Timeout