1

i'm currently developing an new web application using ASP .NET MVC5 framework on my machine (local development environment). I need to implement user authentication via Active Directory. As I'm still in the development phase, there's a server hosted as a virtual machine in my network. The server is where i will host the application and it contains the Active Directory. I want to know if it is possible to perform an AD authentication to the server from my local environment to ensure that my codes are working before pushing the codes to the server.

1 Answer 1

2

You will want to use Windows authentication. There is lots of information online on how to set that up.

Windows authentication will use Active Directory if the server is joined to a domain. But it also allows a client to authenticate with a local Windows account (an account that only exists on the server the website is running from).

So if your dev environment is not joined to an Active Directory domain, just use a local Windows account to test with. Once you put it on the server, it will work with AD accounts in the domain that the server is part of.

Sign up to request clarification or add additional context in comments.

5 Comments

Passing credentials in DirectoryEntry constructor if connection with remote AD can be established may be an option. The other one is to use netonly thread impersonation. From my experience creating a connection factory, that provides connections to AD is a good choice. However, it's a complicated solution, which may not be required in this case
It depends what he needs. If all he needs is authentication and know the username, then he doesn't need to connect to AD remotely. Just use Windows authentication and use a local Windows account to test. If he does need to look up more information about the AD account, then yes, he'll need to fiddle with DirectoryEntry and/or UserPrincipal.
thanks for all your input. for my use case, i will just use windows authentication since the app is going to be hosted in the server after the development phase. However, a followup question, "Once you put it on the server, it will work with AD accounts in the domain that the server is part of." <-- do i need to change the setting in the web.config from windows authentication or AD authentication?
i'm sorry, i just readup about windows authentication and it wasn't suitable for my use case. i have a login page where user are able to enter their username and password to authenticate to a remote AD. therefore i do need to connect to an active directory. should i be using LDAP to connect to a remote AD server? cmjackson.net/2009/10/23/…
Hi all, i have manage to implement LDAP to connect to a remote AD server. thanks for your suggestions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.