Re: change password in active directory by webapplication (vb.net)

From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 04/27/04


Date: Tue, 27 Apr 2004 09:00:21 -0500

You may need to experiment with different variations on the dcDNS variable
and you may need to remove the ServerBind flag if you are using a NETBIOS
name. Also, you may need to remove the Sealing flag as well, but be warned
that in order to set or change passwords, some sort of encrypted channel
(SSL or Kerberos) must be available.

Joe K.

"Sara rafiee" <sara_ir110@yahoo.com> wrote in message
news:OYhkXXBLEHA.556@tk2msftngp13.phx.gbl...
> Hi
> thanks ... very much. yeah it is what I want but again another exception
> occured when I run this code with my own domain
>
>
> The server is not operational
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.Runtime.InteropServices.COMException: The
> server is not operational
>
> Source Error:
>
>
> Line 123: 'you need to either use SecureSocketsLayer or
> Kerberos (Secure + Sealing)
> Line 124: rootDSE = New
> DirectoryEntry(String.Format("LDAP://{0}/rootDSE", dcDNS), username,
> oldPassword, AuthenticationTypes.Secure Or AuthenticationTypes.Sealing
> Or AuthenticationTypes.ServerBind)
> Line 125: rootDN =
> DirectCast(rootDSE.Properties("defaultNamingContext").Value, String)
> Line 126: searchRoot = New
> DirectoryEntry(String.Format("LDAP://{0}/{1}", dcDNS, rootDN), username,
> oldPassword, AuthenticationTypes.Secure Or AuthenticationTypes.Sealing
> Or AuthenticationTypes.ServerBind)
> Line 127: searcher = New DirectorySearcher(searchRoot)
>
>
> Source File: g:\My Documents\Visual Studio
> Projects\netaccount\WebForm1.aspx.vb Line: 125
>
> Stack Trace:
>
>
> [COMException (0x8007203a): The server is not operational]
> System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
> System.DirectoryServices.DirectoryEntry.Bind()
> System.DirectoryServices.DirectoryEntry.get_AdsObject()
> System.DirectoryServices.PropertyValueCollection.PopulateList()
> System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry
> entry, String propertyName)
> System.DirectoryServices.PropertyCollection.get_Item(String
> propertyName)
> netaccount.WebForm1.ChangePassword(String username, String
> oldPassword, String newPassword) in g:\My Documents\Visual Studio
> Projects\netaccount\WebForm1.aspx.vb:125
> netaccount.WebForm1.btn1_Click(Object sender, EventArgs e) in g:\My
> Documents\Visual Studio Projects\netaccount\WebForm1.aspx.vb:35
> System.Web.UI.WebControls.Button.OnClick(EventArgs e)
>
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Rai
> sePostBackEvent(String eventArgument)
> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument)
> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
> System.Web.UI.Page.ProcessRequestMain()
>
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!