Hi
i have create and MVC project and it works fine but if user don’t work on site for a time – when here click any thing on – it’s redirect him to login page and log out from site ?
i try to edit my AppStart as:
app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), LogoutPath = new PathString("/Account/Login"), ExpireTimeSpan = TimeSpan.FromHours(12), // set auto LogOff Time Provider = new CookieAuthenticationProvider { // Enables the application to validate the security stamp when the user logs in. // This is a security feature which is used when you change a password or add an external login to your account. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) } });
as you see i have add:
ExpireTimeSpan = TimeSpan.FromHours(12),
and i open site on 10 am and leave it – and when i try to work on it in 13:30 PM the site is logged out and redirect me to login page ?
so how can i disable auto log out in this site or set to auto log out after 12 Hours as client Need ? – the website Hosted on arvixe.com
Hi,
You need to set the session timeout inside web.config
<sessionState mode="Off|InProc|StateServer|SQLServer" timeout="number of minutes">
for reference please read the below post
http://forums.asp.net/t/1143744.aspx?Managing+Session+TimeOut+using+Web+Config
http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=vs.71).aspx
Hi,
If you don’t have the setting to override it in the web.config, then it will uses that expire time.
<authentication mode="Forms"> <forms loginUrl="~/Account/Login" timeout="10" defaultUrl="~/" /> </authentication>
a.amin
so how can i disable auto log out in this site or set to auto log out after 12 Hours as client Need ?
Set longer time.
Best Regards
Starain
Is you are redirecting explicitly or using Session?