Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

windows authentication mode but not required

I'm using windows authentication mode in my asp.net app. If a user is logged correctly in windows he can access to my site without logins. But if is an external user when he try to access to asp.net app, a logon dialog box is showed. I don't want that logon is required.

I want the username only if the user is logged. but if the user is not logged i don't want to do anything.

like image 956
Luca Romagnoli Avatar asked Dec 09 '25 12:12

Luca Romagnoli


2 Answers

You need to use <authentication mode="Windows"/>, which it sounds like you are AND turn on anonymous access within the IIS configuration.

If they are currently logged in then it should pass their credentials. If they aren't then it should pick up the user that the worker process is running under.

You might see this question for a few more details: How to get Windows user name when identity impersonate="true" in asp.net?

like image 183
NotMe Avatar answered Dec 11 '25 01:12

NotMe


<authentication mode="Windows"/> 
 <authorization>
         <deny users="?" />
 </authorization>

This web.config entry will redirect users to Access Denied page instead of showing the login prompt. Is this what you are looking for?

like image 33
Shoban Avatar answered Dec 11 '25 03:12

Shoban