I am developing a ASP.Net web site which runs on a intranet. The questions I am having is with the login. The users who are admins only can access this web site. This is checked against a Table in SQL. It has each user name and a column called 'isAdmin'. So I want to use windows authentication to log in to the site and show a access denied page if the user is not an Admin. Checking 'isAdmin' column with the windows user name. How can I achieve this. Appreciate if you can find a solution for this.
Asked
Active
Viewed 61 times
0
-
1Have you tried anything? – Izzy Mar 19 '15 at 09:34
-
I tried with just windows authentication. I am having the question of how to check the users with the DB. Is it a HttpHandler? Or Can I use Forms authentication with a login page to check the windows users and also the DB? – SPKan Mar 19 '15 at 09:37
-
1You need to connect to db and do a select query with condition: user name = @loggedUser and isAdmin = 1. If result will have no rows it means he is not ad admin and he Can't access Your page. – MajkeloDev Mar 19 '15 at 09:38
-
Yes true. But do I need to work with forms authentication for this? – SPKan Mar 19 '15 at 09:44
1 Answers
2
You can refer to the following link for your answer: Windows authentication and Forms authentication in same application The reply in the link has a situation similar to yours.

Community
- 1
- 1

Sormita Chakraborty
- 1,015
- 2
- 19
- 36