none
.NET MVC Authothentication - Authorisation

    Question

  • Hi, 

    I have inherited MVC solution and I have a request for Admin page to be authorised. I have decorated the controller for the page with [Authorize(Users ="*")] which automatically redirects Admin to Login page, but when I provide the username and pass (that are stored in a custom DB) I just load the same Login page, the button 'login' has the following redirect http://localhost:53959/Account/Login?ReturnUrl=%2Fadmin- which is the right page.

    Thank you for your help.

    N


    Nemnaja Sovic

    Sunday, August 12, 2018 8:24 PM

All replies

  • Hi Nemnaja,

    It would be better if you would attach your AccountController here. Anyways, you can debug to your Login (Post method). Either it's redirecting to Login view again. Or, you can debug ReturnUrl. Anyways after getting successful user you must redirect to HomeController Index view. Thanks

    Tuesday, November 13, 2018 7:18 AM