I'm running ASP and MVC3 on Winhost.com and I am constantly getting logged out using Windows Forms authentication. I will go from one to two pages and it will work but when I go to our create c开发者_如何学Goharacter page it is logging you out. Sometimes it will do it, sometimes it won't and it happens randomly on different pages. I have researched but I'm having an issue finding something that matches this description.
Either that or I am just not searching the correct stuff..
Any help would be greatly appreciated!
Im sure you've checked this but is it actually logging you out or maybe just hitting the logon page after being redirected from [Authorize]
action methods with roles based access?
If you click back on your browser and go to the previous page, that also required authentication can you view it or is it bouncing you to the logon page too?
Stick a debug line in your "logout" action method and see if your ever hitting that by accident somehow?
Just some general ideas, sorry I can't help without seeing more info.
Edit :
Also, can you check this section in your web.config? Here's an example from one of my applications:
<authentication mode="Forms">
<forms loginUrl="~/Account/Logon" timeout="2880" />
</authentication>
What is your timeout?
I wrote a blog post regarding this exact issue in WinHost:
http://lostinthegc.wordpress.com/2012/03/19/winhost-mvc3-web-application-users-are-logged-out-sessions-lost/
It boils down to adding the necessary SQL Schema tables to support sessions and adding a Machine Key to web.config.
精彩评论