DirectoryServices auth problem asp
- by ChrisMuench
Hello,
I'm getting the following error
[error]
IIS://networth-web6/W3SVC/AppPools/netbasistest errorSystem.Runtime.InteropServices.COMException (0x80020006): Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)) at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) at ASP.nb_test_aspx._Render_control1(HtmlTextWriter __w, Control parameterContainer)
[/error]
any ideas? I know my username and password work just fine to rdp into the server.
when use with this code.
[code]
<%@ Page Language="vb" %
<%@ Import Namespace="System.Xml" %
<%@ Import Namespace="System.Management" %
<%@ Import Namespace="System.DirectoryServices" %
<%
Response.Write("")
Dim AppPoolFullPath As String = "IIS://networth-web6/W3SVC/AppPools/netbasistest"
Dim Username as String = "networth-web6\username"
Dim Password as String = "password"
Try
Dim w3svc As New DirectoryEntry(AppPoolFullPath,Username,Password)
w3svc.Username = Username
w3svc.Password = Password
w3svc.Invoke("Recycle", Nothing)
Response.Write(AppPoolFullPath & "")
Catch exc as exception
Response.Write(AppPoolFullPath & " error"&exc.tostring()&"")
End Try
Response.Write("<p />-- done --")
Response.Write("</BODY></HTML>")
%>
[/code]