Hello,
I create a new web application, but this web application will allow all the full-time and part-time faculty to access this web application in the college.
All the faculty belong to LDAP in the AD domain. So I don’t want to add about 500 faculties into the table and assign the login for them. Also, every year will have some faculty leaving and some comming.
So is there a way in the login page to help me code to log in and check for the AD account and allow the faculty to go into my web application without adding each of them into the table?
So far, this is what I have, and can you help me fix it if I am missing something?
Public Function AuthenticateUser(ByVal LDAPStr As String, ByVal Username As String, ByVal Password As String) As Boolean
Try
Dim Entry As System.DirectoryServices.DirectoryEntry = New System.DirectoryServices.DirectoryEntry(LDAPStr, Username, Password)
Dim nativeObject AsObject = Entry.NativeObject 'Authenticate username and password
Return True 'Correct credentials
Catch
Return False 'Incorrect credentials
EndT ry
End Function
Protected Sub LoginButton_Click(sender As Object, e As EventArgs)
If AuthenticateUser("LDAP://ad.fullerton.edu/DC=ad,DC=fullerton,DC=edu", Login1.UserName(), Login1.Password()) = True Then
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(Login1.UserName, False)
Response.Redirect("~/Faculty/Landing.aspx")
End If