Access Denied trying to instantiate a wrappered com object?


Ben Pryhoda

I have already used a third party com object in my code,
and it went easily. Add the reference, call the methods,
and get my results.
But I am integrating a legacy com object and I follow the
same steps, the auto complete works, the compiler likes
my code, but when I test, pressing the button that
triggers the code segment gives me an access is denied
error and a stack trace that claims the problem is in my
instantiation. (Error cut and pasted to the end of the

I found some references to the same issue about working
with office from c# as well.

The only difference between teh 3rd party component and
mne is that the 3rd party piece is a dll, and the legacy
code is a exe. And I noticed that all the documentation
specifies that dll's can be wrappered. Is this my issue?
My goal is a stand alone process that does a specific
task outside my thread, so I do not want to have a dll
that runs in my process.

Thank you in advance.

The Error:
Access is denied.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and
where it originated in the code.

Exception Details: System.UnauthorizedAccessException:
Access is denied.

ASP.NET is not authorized to access the requested
resource. Consider granting access rights to the resource
to the ASP.NET request identity. ASP.NET has a base
process identity (typically {MACHINE}\ASPNET on IIS 5 or
Network Service on IIS 6) that is used if the application
is not impersonating. If the application is impersonating
via <identity impersonate="true"/>, the identity will be
the anonymous user (typically IUSR_MACHINENAME) or the
authenticated request user.

To grant ASP.NET write access to a file, right-click the
file in Explorer, choose "Properties" and select the
Security tab. Click "Add" to add the appropriate user or
group. Highlight the ASP.NET account, and check the boxes
for the desired access.

Source Error:

Line 204: }
Line 205: string jobid = "";
Line 206: MaintenanceRx.CJobRx
JobDel = new MaintenanceRx.CJobRx();
Line 207:
Line 208: if(Request.Form.ToString
() != "")

Source File:
s Line: 206

Stack Trace:

[UnauthorizedAccessException: Access is denied.]
ProcessRx.Config.btnDelete_Click(Object sender,
EventArgs e) in
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

entHandler.RaisePostBackEvent(String eventArgument) +57
(IPostBackEventHandler sourceControl, String
eventArgument) +18
(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277


Hey Ben
Were you able to solve the problem? I am getting into the same issue. I have a COM object that I have wrapped inside a .Net dll(no compilation errors there). When I try to invoke a function from the .Net dll via a ASPX page, I get an "Access is denied" error at the point in the .Net dll where an instance of the COM class object is created.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question