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>
this is my IISExpress settings:
This is my startup.cs file:
public class Startup
{
public IConfiguration Configuration { get; }
private const string DefaultConnection = "DefaultConnection";
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<AckPackage.Data.AckContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString(DefaultConnection)));
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
//services.AddAuthentication(options =>
//{
// options.DefaultAuthenticateScheme = IISDefaults.AuthenticationScheme;
// options.DefaultChallengeScheme = IISDefaults.AuthenticationScheme;
//});
services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
.AddNegotiate();
services.AddAuthorization(options =>
{
options.FallbackPolicy = options.DefaultPolicy;
});
services.AddHttpContextAccessor();
services.AddControllersWithViews();
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddDistributedMemoryCache();
services.AddSession(options =>
{
options.IdleTimeout = TimeSpan.FromSeconds(120);
options.Cookie.HttpOnly = true;
options.Cookie.IsEssential = true;
});
services.AddRazorPages();
//services.AddMvc().AddRazorRuntimeCompilation();
services.BindingAppServices(Configuration);
services.Configure<Microsoft.AspNetCore.Http.Features.FormOptions>(x =>
{
x.ValueLengthLimit = int.MaxValue;
x.MultipartBodyLengthLimit = int.MaxValue; // In case of multipart
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseSession();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Employee}/{action=Create}/{id?}");
endpoints.MapRazorPages();
});
// app.MapRazorPages();
}
any help will be greatly appreciated.



<windowsAuthentication enabled="true" />in config file. this can be the reason you are getting prompt. could you try setting it to false. and share the program.cs file