Click here to Skip to main content
15,505,786 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I would like to take the simple "My ASP.NET Application" that Visual Studio 2010 creates and recode the "Login.aspx" to work against Active Directory LDAP.

the other staffers would prefer that all coding for the web stuffs be done in Visual Basic and using Visual Studio 2010.

I an am extreme newbie with the above tools and have only started working with ASP about a month ago.

I've been scouring the web with google for the past few days and I have a feeling my brains are leaking out my ears - most of the working examples are in C#.

Modifying web.config with the MINIMAL amount of cruft to make a basic LDAP connection is part 1

Part 2 is modifying the HTML, VB code behind of the Login.ASPX so that it passes back to the Default.aspx the right token to say a VALID LDAP/AD user's credentials were used.

Anyone have any links?
or anyone want to volunteer code?

Rich Leonard
FionaDM 11-Mar-11 5:44am    
Did you get a solution yet? I can do this in c# using VS2008 but not VS2010.

You don't need to recode your Login.aspx to work against Active Directory.
You need to create a .NET membership provider based on the active directory.

Look into this article:

Active directory membership

Your code will stay almost the same. There are some limitations comparing regular aspnet membership provider and active directory membership provider. But you will have to do your home work.
Share this answer
aidin Tajadod 7-Nov-10 1:32am    
Thanks, good link.
Hi RMLeonard,

As I underestood you want windows authentication in your
So I think you just need to add these code in your web.config:

<authentication mode="Windows"/>
    <deny users="Anonymous"/>

and set your IIS to do the rest.
Share this answer
RMLeonard 5-Nov-10 11:16am    
Not exactly -
I cannot rely on the person at the keyboard being the person who is supposed to be at the keyboard, and managers at home with who knows what at their hands will want to log in. we also have about 50-50 Windows vs Mac on campus. I need a full up server side authentication. Which is why I'd like a simple logon screen with the authentication tied to LDAP or AD. Yes, the windows auth does seem to work IF the person is using MSIE on windows, but I need more a universal solution.

Thank you very much though.
I'll keep digging

aidin Tajadod 5-Nov-10 11:38am    
So Maybe this can help you:
System.DirectoryServices.DirectoryEntry oDE;
oDE = new System.DirectoryServices.DirectoryEntry("LDAP://" + Domain ,userName,password , System.DirectoryServices.AuthenticationTypes.Secure);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900