10

I created a new asp.net-mvc project and during setup I chose to use Windows Authentication.

Now I like to turn it off(at least for a while).

I changed the web.config to this

 <authentication mode="None" />

But that does change anything. It will still prompt me. I am using the IIS Express.

UPDATE: I mean it still prompts me when using Firefox. Internet Explorer will continue and not show my domain username

Jepzen
  • 2,942
  • 6
  • 40
  • 62

5 Answers5

17

1.) Close VS

2.) Remove the .vs/config or the .vs folder next to your solution. The IIS Express regenerates the config/applicationhost.config file. Changing this file does NOT help - it is regenerated

3.) Edit the <project>.csproj.user file. There change the lines

<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>

to

<IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>disabled</IISExpressWindowsAuthentication>

4.) Edit and change the web.config Change

<authentication mode="Windows" />

to

<authentication mode="None" />

or comment the whole authentication XML element.

Juan
  • 4,910
  • 3
  • 37
  • 46
4

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

Hozikimaru
  • 1,144
  • 1
  • 9
  • 20
  • I found a file named administration.config in that folder where I added your suggested line. But Firefox still prompts for credentials – Jepzen Nov 13 '14 at 14:19
  • It is not the administration.config. It should be applicationhost.config. Can you search for this file under your IISExpress directory and edit is as admin then restart IIS. – Hozikimaru Nov 13 '14 at 14:20
  • Just to clarify, IE does not prompt you to login. Is that correct? – Hozikimaru Nov 13 '14 at 14:34
  • Well IE is using impersonate I suspect and it also works for IE. When I turn it on it will display my username and when i turn it off it wont show my username. So yes I believe the problem is only for Firefox – Jepzen Nov 13 '14 at 14:37
  • Might be a long shot but have you tried with Chrome? It is possible that it could be Firefox caching. Does that happen with inprivate/incognito sessions as well? – Hozikimaru Nov 13 '14 at 14:44
  • I tried Chrome, it behaves as IE. Firefox private window keeps asking for login even when turned of. I guess i can write it off as weird behavior for Firefox – Jepzen Nov 13 '14 at 14:53
  • Actually, this may help : http://stackoverflow.com/questions/2135559/windows-authenticated-website-prompt-for-firefox-but-doesnt-for-internet-explor – Hozikimaru Nov 13 '14 at 15:01
  • yeah now it behaves just like the others. Mystery solved, thanks – Jepzen Nov 13 '14 at 15:05
0

I found this was possible in the web config by using the following documentation:

https://learn.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1&tabs=visual-studio

The relevant bloc of web.config is:

  <security>
    <authentication>
      <windowsAuthentication enabled="false" />
    </authentication>
  </security>
MGDavies
  • 1,024
  • 1
  • 17
  • 30
0

You should unload the project, edit the project .csproj file and change the lines:

<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>

Then, you should delete the .csproj.user file for your project, and remove de .vs directory for your solution.

eKek0
  • 23,005
  • 25
  • 91
  • 119
0

The issue is related to Firefox settings.

  • Open firefox and type in the address bar about:config
  • type ntlm in the textbox.
  • Double click on network.automatic-ntlm-auth.trusted-uris and type localhost there.
  • Click on OK.

Reference : Stack Overflow

Nemo
  • 21
  • 7