locked
ASP.NET Core MVC's login doesn't work with HTTPS RRS feed

  • Question

  • Hi, I've followed this example from MSDN:

    https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identityhttps://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity

    Within an MVC controller I have a route that uses the Authorize attribute. If I use standard HTTP going to this page redirects to the login defined above then redirects to the originally requested page after I login. With HTTPS the same code throws only a 401 response code and does not redirect to the login page. However, simply clicking on the Login link allows me to log in just fine.

    To recap:

    1. Used the MVC code from MSDN
    2. Added Authorize attribute to a controller action
    3. HTTP redirects to the login page as expected then to the originally requested url
    4. HTTPS only throws a 401 response with no redirects

    How can I have authentication work the same under HTTPS as HTTP?

    Thanks,

    John

    • Moved by 宝宝徐 Wednesday, March 8, 2017 6:45 AM
    Tuesday, March 7, 2017 4:37 PM

All replies

  • Looks like the issue is withinproject.json.   

    I changed:

        "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0"

    to

        "Microsoft.AspNetCore.Authentication.Cookies": "1.0.1"

    This seems to work but VS 2015 doesn't like 1.0.1. VS is saying it is using the 1.1.0 version of this package.

    Is this the correct package? Why isn't there a 1.0.1 version? It took quite a bite of time time upgrade this project from 1.0.0 to 1.0.1. I can't loose days of development due to an update.

    Thanks,

    John


    Tuesday, March 7, 2017 7:58 PM
  • Okay, this didn't make things better only worse. I've updated all my NuGet packages to the latest only to have a mess. I'm still looking for a solution.

    Thanks

    Tuesday, March 7, 2017 10:10 PM
  • Hi John,

    Thank you for posting in MSDN forum.

    This forum is discussing about the .Net Framework Setup and Servicing, from your description, as your issue is related to .Net Core MVC quesiton , I recommend you post a new thread to: https://forums.asp.net/1146.aspx/1?MVC for a much professional support.

    Thank you for your understanding.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by 宝宝徐 Wednesday, March 8, 2017 5:51 AM
    Wednesday, March 8, 2017 5:50 AM