I have an ASP.NET MVC 4 web application. Running locally, it works fine, but on a web host (which uses shared hosting), the logged in user often logs out of the system, redirecting back to the home page. In most cases, the user logs out after just a few steps.
The website host suggested that my application might use too much memory, but I used the program to profile memory usage, and I confirmed that it does not use excessive amounts of memory - in fact, the application seems to use a fraction of the allocated memory on the web host.
Here's the login method used:
public static Boolean Login(string Username, string Password, bool persistCookie = false) { bool success = Membership.ValidateUser(Username, Password); if (success) { FormsAuthentication.SetAuthCookie(Username, persistCookie); } return success; }
In my web hosting, the form validation timeout is set to 60 minutes, so that shouldn't be a problem, right?
<authentication mode="Forms"> <forms loginUrl="~/Account/Login" timeout="60" /> </authentication>
and the session state timeout value is also set to 60 minutes:
<sessionState mode="InProc" customProvider="DefaultSessionProvider" timeout="60">
Based on the answer here , I added this line as well, which didn't seem to solve the problem:
<machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps"></machineKey>
Any ideas on what might be the problem, and what can I do to solve the problem?