简体   繁体   中英

ASP.NET MVC site always redirects to log-in page

This has got me baffled! I've just created a new site using identity framework 2, and it all works fine except that it always shows me the login page. I've spent some time looking at possible answers on the Internet, so let's eliminate some possibilities.

On my home controller, I haven't got an [Authorize] dressing - and just for good measure, I stuck on [AllowAnonymous] to check this didn't help:

在此处输入图片说明

I don't think I've got any filters which are applying authorisation to all pages:

在此处输入图片说明

Here is part of my web.config:

在此处输入图片说明

The strange thing was that when I first created the site, it worked. I then dressed the home controller with the [Authorize] attribute, which forced me to log in. That all worked too. It's only now that I've removed the [Authorize] attribute that things aren't working.

I'm sure I'm being a bozo, but can't work out why. I've rebuilt my solution, exited and re-entered Visual Studio 2015, etc. I'm using MVC 5 and entity framework 6.

Thanks in advance!

The web config should overwrite the IIS express config but in this case it seems it does not. What you can try to do is to turn it off on the IIS level as well.

You can go to this directory \\IISExpress\\config\\applicationhost.config open up this file and set the <windowsAuthentication enabled="false" /> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM