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. 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. =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=

    File security weirdness createing file.

    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    372
    Steven Cheng[MSFT]
    Dec 29, 2005
  2. Gizmo
    Replies:
    8
    Views:
    509
    Kevin D. Quitt
    Aug 29, 2003
  3. Mick Walker

    Createing a httpmodule to log IIS

    Mick Walker, Oct 29, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    350
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Oct 29, 2007
  4. ScottB
    Replies:
    1
    Views:
    296
    Bob Barrows [MVP]
    Feb 20, 2006
  5. Bee Tard
    Replies:
    5
    Views:
    105
    rio4ruby
    Nov 9, 2008
Loading...

Share This Page