DirectoryServices auth problem asp
        Posted  
        
            by ChrisMuench
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ChrisMuench
        
        
        
        Published on 2010-04-26T20:53:45Z
        Indexed on 
            2010/04/26
            21:03 UTC
        
        
        Read the original article
        Hit count: 715
        
ASP.NET
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]
© Stack Overflow or respective owner