2013-02-28 140 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