SetPassword takes a long time to run

Discussion in 'ASP .Net' started by =?Utf-8?B?QnJpYW4gVw==?=, Oct 6, 2006.

  1. 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-
    =?Utf-8?B?QnJpYW4gVw==?=, Oct 6, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. knea
    Replies:
    2
    Views:
    3,960
    Sajjad Mussani
    Jun 19, 2004
  2. Brent
    Replies:
    2
    Views:
    810
    Brent
    Oct 24, 2005
  3. 1388-2/HB

    LDAP SetPassword Exception help

    1388-2/HB, Aug 29, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    3,327
    1388-2/HB
    Aug 29, 2006
  4. Mick Walker

    Query Takes a Long Time to Run

    Mick Walker, Jul 5, 2007, in forum: ASP .Net
    Replies:
    5
    Views:
    1,366
    bruce barker
    Jul 5, 2007
  5. ptstesting
    Replies:
    5
    Views:
    1,541
    Joe Kaplan \(MVP - ADSI\)
    Apr 3, 2006
Loading...

Share This Page