Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access is denied error using COM dll from ASP.Net

ASP.Net Troubleshooting

Access is denied error using COM dll from ASP.Net

by  Antzz  Posted    (Edited  )
This is an error I encountered and had a tough time cracking it.

The Scenario:
I have an ActiveX dll(COM object) in VB6.
The Usage
(1) I need to call the object directly from within ASP.Net page(through code behind)
OR
(2) I use the object in a .Net DLL and then use the .Net dll from within an ASP.Net page

The Result:
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.

What I tried:
(1) I tried modifying the Web.Config file and set <Identity Impersonate> tag to true. Didn't help.

(2) I went into Internet Services Manager too give permissions to the web site. Didn't help.

(3) I added all users to the COM dll file. Didn't help.

(4) I tried installing all SP for Windows. Didn't help.

(5) Tried everything that my friends here in the forum told me. Didn't work.

The Solution :
(1) The COM dll uses "msvbvm50.dll". Just add aspnet_wp user to the users and voila.
(2) There might be additional dlls that your application uses. Based on the situation, you will probably need to give permissions.

Hope this is helpful to you guys and save you lots of time.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top