ASP.NET MVC Forms Authentication with Active Directory
This is a very basic example of how to integrate Active Directory Authentication using ASP.NET MVC. This is very easy and requires only about 10 minutes to accomplish.
ASP.NET MVC Templates already have the required code and configuration to use the Authentication, so all we need to do is change the configuration to point to our Active Directory instead of SQL Express.
To do this you will need an accessible Active Directory and Visual Studio with MVC templates installed. I won’t show you how to install and configure AD here as I do not have this knowledge, yet!
- Create a new ASP.NET MVC Web Application

- Visual Studio will ask you if you want to create a test project, I usually work in TDD so I always say yes. You should now have 2 projects in your solution.

- If you open the Web.Config file and locate the <connectionStrings>, you will notice there is already a connection; you can remove it and add a new one for you Active Directory.

- Now locate the tags authentication, membership, profile, roleManager and remove them (or comment out). Insert these

- Now run the solution and try it using an existing user. You will need to use username@domain for the authentication to work.
This entry was posted on Monday, May 4th, 2009 at 9:15 am and is filed under ASP.NET, Active Directory, C#.NET, Developement, MVC. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


DotNetShoutout May 28th, 2009 at 11:06 pm
ASP.NET MVC Forms Authentication with Active Directory | MIKE…
Thank you for submitting this cool story – Trackback from DotNetShoutout…