asp.net mvc migration , forms authentication issue
Hi I migrated my asp.net web form application to asp.net mvc. ie contains both .aspx page and mvc views. I'm using Forms authentication and not getting the Forms authentication staus in asp.net mvc view.
开发者_高级运维ie. In Login status, getting Request.IsAuthenticated true in asp.net form page and getting false in mvc view.
If you are using ASP.NET's Membership Provider authentication and authorization methods should be working out of the box in both Web Forms and MVC. You can try to call the Membership.GetUser() method and debug to see the result. It will to solve the problem if you post some code of the places where you call Request.IsAuthenticated.
One note about IsAuthenticated method - if the user is authenticated in a controller and you call Request.IsAuthenticated in the view in the same request it will return false. That's intended behavior, not a bug. The reason is that the authentication cookie is attached to the Response, but the check is made on the Request which is usually not altered. Keep that in mind.
精彩评论