1

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.

1
  • Is your login system done in MVC or webforms (i.e. the standard asp.net login control)? Commented Aug 12, 2010 at 18:45

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.