Table does not exist error.

Discussion in 'ASP .Net' started by Wake-Up-Jeff, Apr 14, 2009.

  1. Wake-Up-Jeff

    Wake-Up-Jeff Guest

    I am trying to get my asp.net code to modify the comment property of the
    user object in AD.
    The idea is that an AD user accesses the web page.
    The user's credentials are used to access the user object and modify their
    own comment field.
    I don't want to use a single domain account to do this for all users. Each
    user can do it for themselves.
    I get the "table does not exist" error when calling the following code:

    con = CreateObject("ADODB.Connection")
    con.provider = "ADsDSOObject"
    con.open("Active Directory Provider")
    com = CreateObject("ADODB.Command")
    com.ActiveConnection = con
    strQuery = "Select distinguishedName from 'LDAP://" & strDomain & "'" & _
    " Where objectCategory = 'Person' AND objectClass='user' AND
    samAccountName='" & strUserID & "'"
    com.commandtext = strQuery
    RS = com.Execute

    the error occurs on com.Execute.

    I have read about impersonation, and have attempted to set this up, but I
    obviously haven't got something correct yet.
    The authentication for my virtual directory has Integrated Windows
    Authentication checked, and no other options checked.
    My web.config file has the following entries:
    <authentication mode="Windows"/>
    <identity impersonate ="true"/>

    I have the computer account on which IIS is running as "Trusted for
    delegation". It is running W2K3 R2. The domain and forest are both at W2K3
    functional level.

    Any hints????
     
    Wake-Up-Jeff, Apr 14, 2009
    #1
    1. Advertising

  2. On 14 Apr., 20:03, "Wake-Up-Jeff" <> wrote:
    > I am trying to get my asp.net code to modify the comment property of the
    > user object in AD.
    > The idea is that an AD user accesses the web page.
    > The user's credentials are used to access the user object and modify their
    > own comment field.
    > I don't want to use a single domain account to do this for all users. Each
    > user can do it for themselves.
    > I get the "table does not exist" error when calling the following code:
    >
    > con = CreateObject("ADODB.Connection")
    > con.provider = "ADsDSOObject"
    > con.open("Active Directory Provider")
    > com = CreateObject("ADODB.Command")
    > com.ActiveConnection = con
    > strQuery = "Select distinguishedName from 'LDAP://" & strDomain & "'" & _
    >            " Where objectCategory = 'Person' AND objectClass='user' AND
    > samAccountName='" & strUserID & "'"
    > com.commandtext = strQuery
    > RS = com.Execute
    >
    > the error occurs on com.Execute.
    >
    > I have read about impersonation, and have attempted to set this up, but I
    > obviously haven't got something correct yet.
    > The authentication for my virtual directory has Integrated Windows
    > Authentication checked, and no other options checked.
    > My web.config file has the following entries:
    > <authentication mode="Windows"/>
    > <identity impersonate ="true"/>
    >
    > I have the computer account on which IIS is running as "Trusted for
    > delegation". It is running W2K3 R2. The domain and forest are both at W2K3
    > functional level.
    >
    > Any hints????


    Hi

    you need to look into DirectoryServices namespace

    The code to modify comments should be something like this

    Dim srch As New DirectorySearcher(de)
    Dim result As SearchResult

    srch.Filter = ("(sAMAccountName=myUserName)")
    result = srch.FindOne()
    Dim EditDe As DirectoryEntry = New DirectoryEntry
    (result.GetDirectoryEntry().Path)
    EditDe.Properties("info").Value = "further info"
    EditDe.CommitChanges()

    Hope this helps
     
    Alexey Smirnov, Apr 14, 2009
    #2
    1. Advertising

  3. He mentioned that this is "asp.net code". I think he just tried to get
    VBS working he found somewhere... I gave him right way to follow...
     
    Alexey Smirnov, Apr 15, 2009
    #3
  4. Wake-Up-Jeff

    Wake-Up-Jeff Guest

    Pardon my ignorance, but I'm new at this asp.net caper.
    I am used to VBScript programming, and that's why the code is what it is.
    I'm happy to modify to use the Directory Services namespace, and will give
    it a try.
    It seems to me however, that the issue is due to Kerberos delegation issues.
    The code works fine if I run IIS on a DC.

    "Mark Rae [MVP]" <> wrote in message
    news:...
    > "Alexey Smirnov" <> wrote in message
    > news:...
    >
    >> He mentioned that this is "ASP.NET code".

    >
    > He has, but it clearly isn't...
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
     
    Wake-Up-Jeff, Apr 20, 2009
    #4
    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. Brad
    Replies:
    1
    Views:
    26,574
    [MSFT]
    Jun 22, 2004
  2. LT
    Replies:
    7
    Views:
    2,146
    Phlip
    Jul 25, 2004
  3. Wake-Up-Jeff

    Table does not exist error

    Wake-Up-Jeff, Apr 14, 2009, in forum: ASP .Net Security
    Replies:
    3
    Views:
    1,450
    Joe Kaplan
    Apr 20, 2009
  4. Aaron_TekRecycle.com

    table does not exist error in AD query?

    Aaron_TekRecycle.com, Jul 25, 2003, in forum: ASP General
    Replies:
    0
    Views:
    275
    Aaron_TekRecycle.com
    Jul 25, 2003
  5. Ollie
    Replies:
    1
    Views:
    1,432
    Ollie
    Apr 29, 2004
Loading...

Share This Page