MVC 4 simple membership. How to check is somebody logged in or not

后端 未结 1 1382
执念已碎
执念已碎 2021-01-22 09:30

I\'m new in mvc 4 and can\'t understand exactly how simple membership worked. After all configuration I put this code to AccountController to see how it works and is it work at

相关标签:
1条回答
  • 2021-01-22 10:04

    Login does not do what you think it does. It does not immediately set the current user, instead it sets a cookie on the users web browser, and on the next page refresh, asp.net will recognize that cookie and give them an authenticated request.

    This is not specific to simple membership, that's how all authentication works in asp.net. Once authenticated, the page has to be refreshed for a login to be recognized.

    0 讨论(0)
提交回复
热议问题