permissions problem createing a COM object in ASP.NET after upgrade to 2

Discussion in 'ASP .Net' started by Robert Ginsburg, Jan 2, 2006.

  1. I am upgrading an existing .NET 1.1 project to 2.0. (yes the project
    continues to work perfectly in 1.1). The project includes a reference to an
    assembly that manages communication to several databases and COM objects.
    Since we need to be able to update the COM objects, the COM interop is hand
    coded and is "late bound". That is so say, the progID is interograted to
    create the object and the instances of the object are invoked by
    InvokeMethod. (see snippet below). The Activator.CreateInstance always
    throws a COM 80070005 error (which is an access denied). The DCOM
    permissions are set so that everyone and anyone (including anonymous, guest,
    IUSR... etc) has local permission on the COM object. A VBScript test running
    from the console will work fine, the .NET 1.1 site works fine. I have tried
    putting the assembly in the GAC and playing with the trust level of the web
    site, but no matter what combination I use, I get the error.


    Any help or thoughts on the matter are appreciated.

    -robert


    // in the constuctor ask for permissions and get our type from our PROGID
    constant
    SecurityPermission oSP = new
    SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
    oSP.Demand();
    m_TMType = Type.GetTypeFromProgID(PROGID); // this works and returns a
    correct type

    // in the method call

    try {
    object oTMObject = Activator.CreateInstance(m_TMType); // this always
    throws an error
    object [] oParms = new Object[4];
    oParms[0] = UserName;
    oParms[1] = Password;
    oParms[2] = bResult;
    oParms[3] = bPWIsExpired;

    ParameterModifier oByRefFlag = new ParameterModifier(4);
    oByRefFlag[0]=false;
    oByRefFlag[1]=false;
    oByRefFlag[2]=true;
    oByRefFlag[3]=true;

    ParameterModifier[] oPMods= {oByRefFlag};
    bReturn = (bool)
    m_TMType.InvokeMember("TestUserCredentials",BindingFlags.InvokeMethod,null,oTMObject,oParms,oPMods,
    null,null);
    if (bReturn) {
    bReturn = (bool) oParms[2];
    PWIsExpired = (bool) oParms[3];
    }
    oTMObject = null;

    }
    catch(Exception ERR) {
    System.Diagnostics.Debug.Write(ERR.Message);
    }
    return bReturn;
     
    Robert Ginsburg, Jan 2, 2006
    #1
    1. Advertisements

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. BBuff
    Replies:
    0
    Views:
    2,644
    BBuff
    Sep 26, 2005
  2. James
    Replies:
    1
    Views:
    490
    Bruce Barker
    Nov 3, 2005
  3. Paul Newman
    Replies:
    1
    Views:
    627
    Paul Newman
    Oct 24, 2006
  4. amit sinha

    Upgrade web ASP.net 1.x to ASP.net 2.0

    amit sinha, Oct 4, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    426
    Mike Placentra II
    Oct 4, 2007
  5. Robin

    How to upgrade ASP.NET 1.0 to ASP.NET 1.1

    Robin, Sep 25, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    171
    Robin
    Sep 25, 2003
  6. Jason Blair

    Problem with ASP after upgrade to IIS 6

    Jason Blair, Jan 27, 2005, in forum: ASP General
    Replies:
    6
    Views:
    363
    Tom Kaminski [MVP]
    Jan 27, 2005
  7. ScottB
    Replies:
    1
    Views:
    374
    Bob Barrows [MVP]
    Feb 20, 2006
  8. Replies:
    5
    Views:
    509
    Dr.Ruud
    Jul 5, 2006
Loading...