Hi guys,

I'm using Crystal Reports here. In the development stage (not published), my application works perfectly. After publishing, my application also works perfectly but whenever the crystal report involves images (picture of an employee, for example), this error pops-up.

Access to the path <pathname> 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 to the path <pathname> 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 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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[UnauthorizedAccessException: Access to the path 'C:\temp\Pictures\130.jpg' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +2001955
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +998
System.IO.FileStream..ctor(String path, FileMode mode) +64
DetailReport.ImageTable(String ImageFile) +94
DetailReport.ShowData(Int32 id, DateTime d) +898
DetailReport.Page_Load(Object sender, EventArgs e) +954
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

I already set the security permission, User: ADMIN\Everyone to full-access, but this error still pops-up. Any ideas how will I make it work?

Also, the following links doesn't work for me:
http://www.element-it.com/Access-to-...is-denied.aspx
http://weblogs.asp.net/bsimser/archi...04/252512.aspx

>I already set the security permission, User: ADMIN\Everyone to full-access, but this error still pops-up. Any ideas how will I make it work?

Set permission for USERS group and Internet guest user account.

thx for the reply.

It also doesn't work, but I've found something that works:

Add this user "{machine name}\ASPNET"

Thanks :D

Hi Claude2005 ,

Yes.You need to provide permission to access to a folder to ASPNET account if you are running your website in Windows XP. Also you need to provide access to the folder to Network Service account if you are running your web site in Windows Server 2003.

Hi Claude2005 ,

Yes.You need to provide permission to access to a folder to ASPNET account if you are running your website in Windows XP. Also you need to provide access to the folder to Network Service account if you are running your web site in Windows Server 2003.

Hi Ramesh,

How do you provide access to the folder to Network Service account?

1. Open Windows Explorer
2. Right click on the folder
3. Select Properties menu. It will oen Properties windows
4. Click Security tab.
5. Click Add button and enter Network Service and click OK.

This is required only if you deployed your application in IIS on Windows 2003. For Windows XP deployment, you need to provide access to ASPNET Account

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.