身份验证在ASP.NET MVC中过期

时间:2017-10-04 19:28:43

标签: asp.net asp.net-mvc authentication forms-authentication

我想将用户登录到ASP.NET MVC站点,会话在几分钟内就会异常快速到期。我希望会议能够持续好几天。使用System.Web.Security进行身份验证:

FormsAuthentication.Authenticate(username, password);

我的web.config看起来像这样:

<system.web>
    <customErrors mode="Off" />
    <httpRuntime targetFramework="4.5" />
    <compilation debug="true" targetFramework="4.5" />
    <authentication mode="Forms">
        <forms loginUrl="~/Account/Login" 
             name=".ASPXAUTH" 
             timeout="86400" 
             slidingExpiration="true" 

             defaultUrl="Day/ListDays" 
             path="/"
             protection="All"
             requireSSL="false"
             cookieless="UseDeviceProfile" 
             domain=""
             enableCrossAppRedirects="false">
            <credentials passwordFormat="Clear">
                <user name="user" password="-" />
            </credentials>
        </forms>
    </authentication>
    <sessionState mode="StateServer"
       stateConnectionString="tcpip=loopback:42424"
       cookieless="false"
       timeout="300" />
</system.web>

0 个答案:

没有答案