Reputation: 905
I have visual studio installed on my local machine and the MVC project is present for the development server. I have to use windows authentication to see if users are authenticated using windows login.
All users will have a local workstation of the company and they are going to login to the website we are developing using visual studio and development server.
My query is- if i do windows authentication, i need to check the windows user details of the employee in the companys user database. I donot want to check the active directory of the development server where the website is present.
Will this code help me to check authentication by referring it to the companys active directory database ?
if (httpContext.User.Identity.IsAuthenticated)
Upvotes: 1
Views: 44
Reputation: 2402
Yes, that works regardless of what kind of authentication you are using. However, you want
HttpContext...
not
httpContext
Also, you'll need to enable windows authentication in your web.config file for this to work.
<system.web>
...
<authentication mode="Windows"/>
...
</system.web>
See https://msdn.microsoft.com/en-us/library/ff647405.aspx
Upvotes: 2