11

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

5 Answers 5

19

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.

Sign up to request clarification or add additional context in comments.

Comments

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

8 Comments

I found a file named administration.config in that folder where I added your suggested line. But Firefox still prompts for credentials
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.
Just to clarify, IE does not prompt you to login. Is that correct?
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
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?
|
1

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.

1 Comment

Of all the answers this is the one that makes a change that is persisted into source control. I'm guessing these parameters in the csproj will cause the msbuild process to write the relevant entries to the applicationhost.config file.
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>

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.