I used Membership and this code to create a persistent cookie to prevent user automatically sign-out after sign-in:
FormsAuthentication.SetAuthCookie(user.Id.ToString(),true);
And use this setting in web.config file:
<authentication mode="Forms">
<forms name=".mywebsite" cookieless="UseCookies" loginUrl="~/Account/SignIn" defaultUrl="~/ManagePanel/Statistic" slidingExpiration="true" protection="All" path="/" timeout="43200" />
</authentication>
<sessionState mode="InProc" timeout="43200" />
<httpModules>
<modules>
<remove name="FormsAuthenticationModule" />
<add name="FormsAuthenticationModule" type="System.Web.Security.FormsAuthenticationModule" />
<remove name="UrlAuthorization" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<remove name="DefaultAuthentication" />
<add name="DefaultAuthentication" type="System.Web.Security.DefaultAuthenticationModule" />
</modules>
I want to user just can sign-out only when hit sign-out button and don't want to sign-out after a while.
How can I solve my problem?