Yesterday I had a task to integrate a web application with the active directory of the company.
On the load of the login page a check has to be done to insure that:
so here are the steps i followed to solve the problem
1. Set the authentication mode in the web.config to "Windows"
On the load of the login page a check has to be done to insure that:
- the user is logged to the right domain. (compare the user current domain with the company's domain).
- the user has an account in application.
so here are the steps i followed to solve the problem
1. Set the authentication mode in the web.config to "Windows"
2. On the load of the page, add the call of the following function:
Sub CheckUserOnActiveDirectory()
If Application.Item("CheckOnActiveDirectory") Then
If User.Identity.IsAuthenticated Then
Dim strFulName As String
Dim strDomainName As String = String.Empty
strFulName = Page.User.Identity.Name 'This will rturn Domain\User
strUsername = strFulName.Substring(strFulName.IndexOf("\") + 1, strFulName.Length - strFulName.IndexOf("\") - 1)
strDomainName = strFulName.Substring(0, strFulName.IndexOf("\"))
Me.Session("UserID") = intUserID
Me.Session("UserRole") = intUserRole
Me.Session("EmployeeID") = intEmplyeeId
End If
End Sub
and we done :)
1 comment:
Assalamu alaikum! warm greeting ^^!
your blog looks nice 0_0
by the way,
if you need to find unique fonts, you can go to our website.
best regards;
Post a Comment