问题
The WebSecurity component in Webmatrix is pretty slick, but users' sessions expire too quickly for me. It seems like it's measured in hours and I'd like the session timeout to be more in terms of days.
How do I change the session timeout?
回答1:
In answer to your question, you can set any value for session timeout in your web.config:
<configuration>
<system.web>
<sessionState timeout="value_in_minutes"></sessionState>
</system.web>
</configuration>
By default, sessions expire 20 minutes after the last activity from the user. Having sessions last for days seems insane. There is absolutely no sensible reason that I can think of for that. What problem are you trying to solve, exactly?
来源:https://stackoverflow.com/questions/7870778/asp-net-razor-webmatrix-sites-logout-user-too-quickly-how-to-change