Hi,
I am developing an web application in c# MVC, I am facing an issue in login session time. After few minutes login when I refresh the page or go to another page, it will logout and redirect to login page. I also set the "timeout="1440" in web.config file. Kindly go through following code.
WEB.CONFIG
"4.5" tempDirectory="C:\Inetpub\vhosts\webdealsinv.com\tmp" />"4.5" />"Forms" >"Home/Login" timeout="1440" slidingExpiration="true" />"true" defaultProvider="InvRoleProvider" cookieTimeout="1440">"InvRoleProvider" type="Inventory.Helper.InvRoleProvider" />"*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />"GET" path="routejs.axd" type="RouteJs.RouteJsHandler, RouteJs" />"1440" />"InProc" timeout="1440" cookieless="false" />
LOGIN ACTION
- [HttpPost, AllowAnonymous]
- public ActionResult Login(InvUser invuser)
- {
- string result = objData.CheckUser(invuser);
- if (result == "Success")
- {
- InvUser _invuser = objData.GetUser(invuser);
- FormsAuthentication.SetAuthCookie(_invuser.UserID.ToString() + "|" + _invuser.FirstName, true);
- return RedirectToAction("Index", "Admin");
- }
- else
- {
- ViewBag.Msg = "Invalid Email or password!";
- return View();
- }
- }

Sachin SinghRank #66 · 26.2K reputationPosted Jan 20, 2021, 8:08 AM EST
Arif Hussain30 reputationPosted Jan 20, 2021, 5:03 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Jan 20, 2021, 5:32 AM EST
Arif Hussain30 reputationPosted Jan 20, 2021, 6:41 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Jan 20, 2021, 6:48 AM EST
Arif Hussain30 reputationPosted Jan 20, 2021, 7:12 AM EST
Mageshwaran RRank #411 · 6.1K reputationPosted Jan 20, 2021, 11:59 AM EST
Arif Hussain30 reputationPosted Jan 21, 2021, 7:56 AM EST