i have developed a site with mvc5 and hosted in IIS 7. a weird issue is encountering that session is expiring frequently. i just do not understand reason behind session expire before 20 minute. my session time out is 20 minute and sliding expiration is also
there.
at last i handle session expire this way
var myImg = document.getElementById("keepAliveIMG");
if (myImg) {
window.setInterval(function () {
myImg.src = myImg.src.replace(/\?.*$/, '?' + Math.random());
}, 36000);
}
Now session is not expiring but i need to understand root cause what mistake i made for which session is expiring before time. please tell me what are the area i need to change or look into to fix this issue. waiting for suggestion. thanks
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
77 Points
150 Posts
Often Session expire problem encounter in asp.net MVC 5
Oct 12, 2020 06:08 PM|TDP|LINK
i have developed a site with mvc5 and hosted in IIS 7. a weird issue is encountering that session is expiring frequently. i just do not understand reason behind session expire before 20 minute. my session time out is 20 minute and sliding expiration is also there.
at last i handle session expire this way
Now session is not expiring but i need to understand root cause what mistake i made for which session is expiring before time. please tell me what are the area i need to change or look into to fix this issue. waiting for suggestion. thanks
All-Star
53081 Points
23648 Posts
Re: Often Session expire problem encounter in asp.net MVC 5
Oct 12, 2020 10:00 PM|mgebhard|LINK
I assume your code is on a shared host where the timeout is not 20 minutes like you think. Contact your host for assistance.
Contributor
2760 Points
789 Posts
Re: Often Session expire problem encounter in asp.net MVC 5
Oct 13, 2020 06:37 AM|YihuiSun|LINK
Hi TDP,
Best Regards,
YihuiSun
Member
77 Points
150 Posts
Re: Often Session expire problem encounter in asp.net MVC 5
Oct 13, 2020 07:39 AM|TDP|LINK
Sir no code is running in office pc.