Probably Basic Authentication is enabled and Anonymous Authentication is disabled. If you use IIS or IIS Express check the Authentication settings of the site.
running asp.net intranet application on localhost asking for authentication
I have an intranet application written int ASP.net core, when I run this application on localhost, I get a pop window asking me to authenticate and once I enter my domain name\my username and password then it authenticates me and lets me run the application. Basically, I enter my Windows username and password and then I can see the application. Below is the screen of what I am getting:
this is what I tried:
- went to the folder where the application resides
- right click on it and click on the properties
- properties->Security tab and gave full control to myself. Below is the screenshot:
This is what I have in web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>
<runtime>
</runtime>
</configuration>
Since this is happening in localhost. Below is the screenshot of IIS express settings:
any help will be greatly appreciated.
2 answers
Sort by: Most helpful
-
-
Brando Zhang-MSFT 2,961 Reputation points Microsoft Vendor
2024-05-07T07:05:38.0433333+00:00 Hi @Anjali Agarwal,
According to your screenshot, you could find you have enabled the windows authentication inside your application.
You have enabled both using the web.config(IIS express) and your startup.cs.
If you don't want to use windows authentication, you set the web.config as below and remove the related codes inside the startup.cs:
<configuration> <location path="." inheritInChildApplications="false"> <system.webServer> <security> <authentication> <anonymousAuthentication enabled="true" /> <windowsAuthentication enabled="false" /> </authentication> </security> </system.webServer> </location> <runtime> </runtime> </configuration>
Remove below line:
services.AddAuthentication(NegotiateDefaults.AuthenticationScheme) .AddNegotiate();
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.