SetPassword takes a long time to run

G

Guest

Using ASP.NET 2.0 I have a webpage to set a users password although it is
taking up to 38 seconds to run. Tracing the code shows that the line of code
used to invoke the new password appears to be the hold up. Any thoughts? Code
is below:

Sub Button_SubmitReset(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit1.Click
Dim AdEntry As New DirectoryEntry("LDAP://" &
AppSettings("DcServerName").ToString() & "/" &
AppSettings("AdPath").ToString(), AppSettings("AdAdminUserName").ToString(),
AppSettings("AdAdminUserPassword").ToString(), AuthenticationTypes.Secure)
Dim AdFilter As String =
"(&(objectCategory=person)(objectClass=user)(UserPrincipalName=" &
Session.Contents("UserPrincipalName") & "*))"

Using AdEntry
Dim AdSearcher As New DirectorySearcher(AdEntry, AdFilter)
Using AdSearcher
AdSearcher.PageSize = 1
AdSearcher.SearchScope = SearchScope.Subtree

Dim Result As SearchResult = AdSearcher.FindOne()

If (Result Is Nothing) Then
lblMessage1.Text = "Unable to retrieve your network account information."
Else
Dim AdUserEntry As DirectoryEntry = Result.GetDirectoryEntry()
' Get auto generated password
Dim strPG As String = ""
strPG = PasswordGenerator()
' Set the password
Trace.Write("Invoke", "--- [ BEGIN ] ---")
AdUserEntry.Invoke("SetPassword", New Object() {strPG})
Trace.Write("Invoke", "--- [ END ] ---")
AdUserEntry.CommitChanges()
' Exit
lblPassword.Text = strPG
strPG = ""
End If
End Using
End Using
End Sub

I appreciate any suggestions.
-brian-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top