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!

System.UnauthorizedAccessException: Access is denied. -(calling a dll)

Status
Not open for further replies.

bucca

Programmer
Sep 9, 2003
12
GB
Hi,

I am in the process of writing my first .net application. My application runs with asp.net and c#. The c# code calls a dll called 'MapPointApp.dll'. When the code calls the dll I get the following error message.

--------------------------------------------------------------------------------------
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=&quot;true&quot;/>, 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 &quot;Properties&quot; and select the Security tab. Click &quot;Add&quot; to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
-------------------------------------------------------------------------------------

I understand that the ASPNET user does not have the permission to call the dll, but I cannot work out how to grant the account the permissions required, as described in the last line of the error message, as I have no securities tab as described in the error message. (I am running IIS on XP pro).

I have tried using <identity impersonate=&quot;true&quot;/> in the web.config file, the system then works fine if you’re accessing the application from the server machine, but if you are on a different machine you are requested to enter a password when you reach the point in the application that call the dll.

Don’t honestly know if this is important but I also have the following lines in the web.config file and I am using MobileFormsAuthentication for the application.

<authentication mode=&quot;Forms&quot;>
<forms name=&quot;.theDefault&quot;
loginUrl=&quot;~/logon.aspx&quot;
path=&quot;/&quot;
protection=&quot;All&quot;
timeout=&quot;15&quot; >
</forms>
</authentication>

If anyone has any ideas or could recommend any reading material please reply, as any help would be most appreciated

Cheers and thanks again for any help
 
Hi Bucca

You have no security tab when you right click and select properties for the .dll? That seems strange. Have you tried setting the ASPNET account to have execute permissions on the folder the .dll is in instead?

Your forms authentication should'nt have anything to do with it.

Hope this helps

Rob

 
Yeah, there’s certainly no securities tab just General, sharing, web sharing and Customize

Thanks anyway.
 
Eventually discovered this problem was to do with having a system built on a FAT32 partition.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top