My MVC application is running under Windows Authentication.

I have used TempData at various places in my application. The problem is that, they get clear with session timeout. however, the Windows login is still running. How can I set them to remain intact until the user logs off his windows login.. I mean, there shouldn't be any timeout as such. is it possible?

有帮助吗?

解决方案 2

TO my understand, TempData only gets persist it's value till the next action, which is why it's called "Temp"Data. And a session will be only be able to maintain the data for current user session.

If you don't want timeout(which sounds really weird to me and i can smell bad code practice) then use Cache or persist data to database. You can keep the data as long as you want.

其他提示

You can change session timeout value in the web config:

<sessionState mode="InProc" timeout="20"/>

Just change the minutes timeout value from 20 minutes to a higher value

e.g for 2 days:

<sessionState mode="InProc" timeout="2880"/>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top