-1

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:

enter image description here

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

enter image description here

Here is part of my web.config:

enter image description here

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!

Andy Brown
  • 5,309
  • 4
  • 34
  • 39
  • Can't understand your question it always shows me the login page .you want to show login page always? – Hetal Rupareliya May 06 '16 at 11:23
  • @Andy Brown, try this: https://technet.microsoft.com/en-us/library/cc731244(v=ws.10).aspx – Husni Salax May 06 '16 at 12:09
  • @Andy Brown have you tried clearing your browser cache? Perhaps there's some ASP authorization cookie in there that is making MVC think it's using Forms authentication? Not sure. – Jon May 06 '16 at 12:22
  • Good idea. Using Firefox. Just cleared cache, but sadly made no difference. – Andy Brown May 06 '16 at 12:45
  • I've gone through just about every SO answer I can find - still no joy. The question at http://stackoverflow.com/questions/24745311/mvc-4-application-goes-to-login-page-first-using-windows-auth-when-run is a duplicate, but the answer isn't relevant for me. – Andy Brown May 06 '16 at 12:56

1 Answers1

0

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" />.

Husni Salax
  • 1,968
  • 1
  • 19
  • 29
  • Thanks. Sadly, when I found this file (it's in My Documents, for anyone else looking), it contains already: – Andy Brown May 06 '16 at 12:46
  • @AndyBrown, Try to create new project and test it – Husni Salax May 06 '16 at 13:00
  • The reason I'm here in the first place is that this is the third time I've had to solve other problems by starting again with a new project. I don't think this would achieve much. – Andy Brown May 06 '16 at 14:22