none
retreiving password from active directory

    Question

  • Dear All,

    I am using form authentication on my sharepoint site and validating  the user from active directory. I need to pass the user name and password entered in login control to some other form. I tried to take those value in session by using
    Session["user"]=Username.Text and Session["pwd"]=Password.Text
    but it is saying username doesnt exist in current context.

    when I tried to use

    string login = Context.Request.ServerVariables["AUTH_USER"];
    and
    string pwd=Context.Request.ServerVariables["AUTH_PASSWORD"];
    I could get the user name but could not get password. it is giving Null.

    I tried to use directoryEntry class to fetch the password from AD as below-

    DirectoryEntry oDe = new DirectoryEntry();
                    DirectorySearcher search = new DirectorySearcher(oDe);
                    search.Filter = "(cn="+login+")";
                    SearchResult res = search.FindOne();
                    DirectoryEntry de = res.GetDirectoryEntry();

    and tried to get the password by using de.password. I was passing the password into SRC of an IFrame control.
    but it is giving the error-" system.directoryservices.directoryentry.password can not be used in this context because  it lacks the get successor."

    Can anyone help me, how to retreive the password from active directory.


    Regards
    Deewaker

    Saturday, February 21, 2009 7:50 AM

All replies

  • Hi,
    retrieving the password from Active Directory is not possible*. The password is not stored in Active Directory, it only stores a hashed value of your password which cannot be encrypted back to the original.

    What are your needs? Are you trying to achieve Single-Sign-On to another resource?

    *) You can set up AD to store the password in a reversible way, but it is not recommended - what happens if someone get read rights on your AD?

    /WW

    http://www.wictorwilen.se/
    Saturday, February 21, 2009 12:47 PM
  •  retrieving the password from Active Directory is not possible*.
    But you can try to enable users to reset their password.
    Monday, February 23, 2009 1:10 AM
  • Hello

    Thanks for the reply.
    I have FBA enabled application. after login we are redirecting user to page whre he/she can see the mails from exchange server. I am using OWA webparts but they again asking for login. to avoid the second login I wants to pass the credential from backend to mail login form. I am able to pass the user name but could not pass the password. I am following the below link to automatically login to mail.

    http://blogs.msdn.com/tconte/archive/2007/01/17/owa-web-part-with-single-sign-on.aspx

    threre are two webparts mentioned in the above link. I am using basicwebpart for this.

    Monday, February 23, 2009 5:01 AM