Link to home
Start Free TrialLog in
Avatar of seckel
seckel

asked on

How do I authenticate form username/password against domain using Active Directory?

Using active directory, I need to know, in vb.net (not C#), how to authenticate the username and password from a login form.

I support the company intranet website and I need further security applied to the website by authenticating the user and password every time the user access the website.  

Please show example...in vb.net (not c#)  Thank you.
Avatar of AerosSaga
AerosSaga

     <TABLE id="Table1" cellSpacing="0" cellPadding="5" width="250" border="1">
                                          <TR>
                                                <TD width="90">Password</TD>
                                                <TD style="TEXT-ALIGN: right" width="140">
                                                      <asp:TextBox id="Password" runat="server" CssClass="ThinInput" MaxLength="12" Columns="4" Width="137px"
                                                            TextMode="Password"></asp:TextBox></TD>
                                          </TR>
                                          <TR>
                                                <TD colSpan="2" align="right">
                                                      <asp:Button id="ProcessLogin" runat="server" CssClass="ThinButton" Text="Login"></asp:Button></TD>
                                          </TR>
                                          <TR>
                                                <TD colSpan="2">
                                                      <asp:Label id="InvalidPassword" runat="server" Visible="False" ForeColor="Red" Font-Size="Larger">Invalid password.</asp:Label></TD>
                                          </TR>
                                    </TABLE>
---------------------------------------------------------------------------------------------------
   Private Sub ProcessLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProcessLogin.Click
        If Password.Text = "8888" Or Password.Text = "pokey1" Then
            Web.Security.FormsAuthentication.RedirectFromLoginPage("Admin", False)
            Response.Redirect("ManageOrders.aspx")
        Else
            InvalidPassword.Visible = True
        End If
    End Sub

Aeros
oops sorry thought you asked for forms authentication
Hello seckel,

If I understand your question correctly, you need something like forms authentication where user enter their user name and password to login your intranet site. And currently the intranet site is using windows authentication. Am I right? please clarify.
The following MSDN Article describes exactly what you are trying to do:

Title: Active Directory Authentication from ASP .NET
URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sds/sds/active_directory_authentication_from_asp__net.asp

HTH, Nauman.
Avatar of seckel

ASKER

ihenry

I have a form that will get the user's name and password.  I then need to authenticate the user name and password against Active Directory (ADSI)...I know how to create the form, I need help with the ADSI logic portion...
Avatar of seckel

ASKER

nauman_ahmed

The link is good, but in C#.  I need to know how to do this in vb.net.
ASKER CERTIFIED SOLUTION
Avatar of ihenry
ihenry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of seckel

ASKER

ihenry,

You are a genius!  That was just what I needed.  Thanks.
nah...just glad I could help :0)
ok so how do you get the LDAP path?
Dim adPath as String = "LDAP://DC=..,DC=.." 'Path to your LDAP directory server

i have tried this one:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;326340

but i don't know what to use for Path to your LDAP directory server

Dim adPath as String = "LDAP://DC=..,DC=.." 'Path to your LDAP directory server
Check the following tutoria:

URL: http://www.codeproject.com/aspnet/adsi1.asp

You can define it as
LDAP://IP_ADDRESS
LDAP://DOMAIN_NAME

HTH, Nauman.
This was the format I needed:

LDAP://domain.ccc-xxxx.net