3

When using Visual Studio's built in web server, every time I make a page request the standard login box pops up and asks for credentials. It doesn't work if I actually put in my credentials, so I just have to hit cancel 5 times so it will go away.

When I run the application through IIS (locally or on test server) it works just fine (no login box comes up).

Anyone know how to fix this or have any idea what might be causing it?

Brian Kim
  • 24,916
  • 6
  • 38
  • 26
Max Schmeling
  • 12,363
  • 14
  • 66
  • 109

4 Answers4

1

I had this same issue. However, my solution was different and the issue seemed different as well.

I had been working on a ASP.NET 2.0 web application, using VS 2008. Everything was working fine with the built-in IIS server. I hadn't opened this project for about a week and then when I chose "View in browser" in VS, I was prompted for my windows login creds. This project never did this before, so I was a bit baffled. I checked all the web.config settings and everything seemed fine. My project settings seemed correct as well. I decided to test the project by opening this same project in VS on a separate dev box on my network using a network path. I again chose "View in browser" and it worked fine. No logon prompt.

This told me that the issue wasn't with the actual web project itself, rather my dev environment. I checked all my browser settings as suggested above, and they were correct. I then compared my project settings while I had the same project (same physical files) opened in both dev boxes. I noticed a difference...

Under the Start Option in the Property Pages, the Web Server was set to use the Default Web server in both cases. However, on the box that was asking for my creds, the NTLM Authentication checkbox was selected. I unselected this and it resolved the issue.

I'm not sure how this was possible since I was opening the same project files, and would assume the project settings would be exactly the same. And the fact it was working fine a week ago really perplexed me. I chalked it up to an issue with VS 2008 on the box with the issue. I hope this helps anyone else that may be running into this issue.

1

I assume you mean JavaScript alert box-looking login dialog, right? This dialog pops up when you make a request to a portion of website where anonymous access is disabled from IIS. It is different from ASP.NET authentication.

Do you have some portion of web site protected? Or are you making any HTTP request to external sites, like images and etc?

If your page looks ok after hitting cancel multiple times, it must be one of those HTTP request to protected file like images, css, js or whatever.

I'd look in Fiddler or Firebug to see if any request is failed when you hit cancel in that login dialog.

I'd also try clearing cache/authenticated session on the page that runs on IIS to see if it actually shows you that login dialog.

Brian Kim
  • 24,916
  • 6
  • 38
  • 26
0

In your project, there should be a vwd.webinfo file.

The following lines control authentication when debugging (in IISExpress). Set as follows to avoid all dialogs.

<VisualWebDeveloper>
<iisExpressSettings anonymousAuthentication="enabled" windowsAuthentication="disabled" useClassicPipelineMode="false"/>
</VisualWebDeveloper>

If windowsAuthentication="enabled" you may still get a dialog, even if anonymousAuthentication="enabled" :-)

mike
  • 2,149
  • 20
  • 29
0

This was because localhost was not in my trusted sites so it wouldn't do automatic NTLM authentication... I'm not sure why it was that way, but it was... adding localhost to the list fixed it.

Max Schmeling
  • 12,363
  • 14
  • 66
  • 109