ADSI - ASP Assistance Required.

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default ADSI - ASP Assistance Required.

    Hi All,

    We've written a couple of functions which, when run in VB6 work fine and
    allow AD users to be updated. When we include the code into an ASP Page and
    try and update a users information (i.e. Mobile Phone Number) we get a
    failure as below...

    Error Number:- -2147467259 Automation error Unspecified error

    Can anyone see why this is happenning? Whe nwe run the DLL from VB6 or
    Studio.NET then it works fine. We've checked the Security permissions on
    the WebServer and it uses the Administrator Account.

    Thanks in anticipation.

    KMP



    TEST HARNESS ASP PAGE
    <html>

    <%@ Language=VBScript %>
    <%
    dim myobj,retval
    set myObj = createobject("TinopADutilityV2.ActiveDirectory")
    retVal = myObj.ConnecttoLDAP("Username","Interactive") ' retVal = 1 if
    successful, 0 otherwise
    response.write(myObj.GetInfo("cn")) & "<br>" ' Display
    Username to show we have right user
    retVal = myObj.UpdateInfo("Mobile", "07990 123456") ' Update
    Details. retVal = 1 if OK, otherwise -1
    myobj.closeLDAP
    %>
    </html>


    VB6 DLL SourceCode

    VERSION 1.0 CLASS
    BEGIN
    MultiUse = -1 'True
    Persistable = 0 'NotPersistable
    DataBindingBehavior = 0 'vbNone
    DataSourceBehavior = 0 'vbNone
    MTSTransactionMode = 0 'NotAnMTSObject
    END
    Attribute VB_Name = "ActiveDirectory"
    Attribute VB_GlobalNameSpace = True
    Attribute VB_Creatable = True
    Attribute VB_PredeclaredId = False
    Attribute VB_Exposed = True
    '***************************************
    '* *
    '* ActiveX dll Developed to interact *
    '* with Active Dirctory.... *
    '* Created by E Strangler 31/7/2004*
    '* *
    '***************************************

    Option Explicit
    Dim objUserInfo As Object
    Dim strLDAPAddress As String

    Public Function ConnecttoLDAP(ByVal strDisName As Variant, ByVal strOrgUnit
    As Variant) As Boolean

    On Error GoTo errCleanUp

    Set objUserInfo = GetObject("LDAP://CN=" & strDisName & ",OU=" &
    strOrgUnit & ",DC=AgendaTV,DC=Co,DC=UK")
    ConnecttoLDAP = True
    Exit Function

    errCleanUp:
    'MsgBox ("An error has occurred. " & Err.Description)
    ConnecttoLDAP = False

    End Function

    Public Function UpdateInfo(ByVal strFieldName As Variant, ByVal strData As
    Variant) As Long

    On Error GoTo Err_Handler

    'Update with new data
    objUserInfo.put strFieldName, strData

    'Commit to the directory.
    objUserInfo.SetInfo
    UpdateInfo = 1
    Exit Function

    Err_Handler:

    UpdateInfo = -1 'If execute fail then return -1

    End Function

    Public Function GetInfo(ByVal strFieldName As Variant) As Variant

    'Returns data specified by the field name
    GetInfo = objUserInfo.Get(strFieldName)

    End Function

    Public Function CloseLDAP() As Long

    'Destroy object
    Set objUserInfo = Nothing

    End Function






    Enigma Webmaster Guest

  2. Similar Questions and Discussions

    1. XML assistance required
      Simple xml problem: I need 8 text input fields into which the user will input statistics (numbers), the user will hit the SAVE button and the values...
    2. ADSI with PHP
      Hi everyone, I'm pretty new to using the COM functionality in PHP. I want to administer my PC using PHP together with ADSI. My first problem is...
    3. ADSI
      Hi, I have found some code that authenticates users agains a domain using ADSI. I then redirect to another page and pass the username they have...
    4. ASP, ADSI and IIS 6.0 Problem
      Hi - I wrote an ASP script that adds users to Active Directory. I have been running this script sucessfully on Windows 2000 with IIS 5.0 for a...
    5. ADSI question
      Hello, I use the following ASP code to access Active Directory's property: Dim objUser Set objUser = GetObject("WinNT://myDomain/UserId") I...
  3. #2

    Default Re: ADSI - ASP Assistance Required.

    U must Trust this computer in AD structure.

    [url]http://www.serverwatch.com/tutorials/article.php/1478231[/url]

    --
    -------
    Pawel Janowski
    [url]http://www.sunrise-tm.com/os_janowski.aspx[/url]


    Paweł Janowski Guest

  4. #3

    Default Re: ADSI - ASP Assistance Required.

    In article <QBbPc.490$yt5.30@newsfe2-gui.ntli.net>, [email]info@enigma-one.com[/email]
    says...
    > Hi All,
    >
    > We've written a couple of functions which, when run in VB6 work fine and
    > allow AD users to be updated. When we include the code into an ASP Page and
    > try and update a users information (i.e. Mobile Phone Number) we get a
    > failure as below...
    >
    > Error Number:- -2147467259 Automation error Unspecified error
    >
    > Can anyone see why this is happenning? Whe nwe run the DLL from VB6 or
    > Studio.NET then it works fine. We've checked the Security permissions on
    > the WebServer and it uses the Administrator Account.
    For some bizarre reason, in ASP you can only run ADSI code if you are
    connected as an "authenticated user". Anonymous connections will not
    create the necessary security level to run ADSI code.

    I got around it by "calling" my ADSI code from an anonymous web page
    using ServerXMLHTTP to do the authentication for me.

    Dave Navarro Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139