Search code examples
c#asp.netiiswindows-authentication

Windows Authentication - How to Deny Users using Code


My Windows Authentication is working with IIS7 but now i want to deny specific users based on the data that i have in SQL server.

I know i can send a information access denied but i want to send windows login form to the user to enter different credentials, so that IIS can authenticate the new credentials and send it to the c# to authorize the user again.

Edit - To rephrase the question

I want to use both windows authentication and authentication based on database data. First i want the users to be authenticated via Windows authentication and then application will authenticate the user. But my question is if the application denies the user then I want the Windows authentication dialog box to show up to the user for windows credentials to start the process from beginning.


Solution

  • One of the method you can do is create your own login form and authenticate user using LDAP queries.

    So initially it authenticates user via windows authentication and if other criteria doesn't satisfy the user access you can send your own login form and authenticate user using LDAP queries.