【发布时间】:2015-07-09 11:54:27
【问题描述】:
我已经阅读了很多示例,但我不知道为什么我的代码不起作用。这是我的web.config 代码在我的ASP.NET 项目中的一部分:
<system.web>
<authentication mode="Forms">
<forms loginUrl="Panel/Login" timeout="525600" slidingExpiration="true" />
</authentication>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="1048576" />
</system.web>
问题是,当我登录时,在我尝试请求某些内容时几分钟不活动后,我被导航到登录页面。即使我在登录页面中设置了持久性 cookie,也会发生这种情况!
我尝试增加和减少timeout 属性。
我试过slidingExpiration属性。
我试过cookieless属性。
它们都不起作用!
我在登录页面中使用此代码:
FormsAuthentication.SetAuthCookie(Username.Text, Remember_Me.Checked);
提前感谢。
【问题讨论】:
标签: c# asp.net forms authentication