Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi ,

I have a XML file in "C" Drive . I want to update and to save that xml using C#. While saving the xml it is throwing error. The error is "Access to the path 'C:\inetpub\wwwroot\sites\mysite\App_Data\roll.xml' is denied". How to diagnose this problem

Thank you,

Regards,
Ramadurai U
Posted
Comments
[no name] 30-Aug-13 9:04am    
"How to diagnose this problem", the problem is self-diagnosing. The error is plainly telling you what the problem is. You just need to give whatever user is trying to access that file, permission to do so.
Dave963 30-Aug-13 9:05am    
Is the site hosted on a server or are you running the site from visual studio?

Credit goes to ThePhantomUpvoter, as he said you just need to change your permissions so that the user running the site will have permission to edit files...
 
Share this answer
 
v2
Change the permissions for IIS user, follow this:
http://support.microsoft.com/kb/308419[^]
 
Share this answer
 
If this is Windows 7 (or Vista) this location is not legal. But don't "change it to D:", and probably don't even change permissions. Better use the directories in a legitimate way. Please see my past answer:
How to find my programs directory[^].

If this is a Web application, you cannot use any directories beyond the directory configures as the root directory for your site. Web applications are run in a sandboxed environment which won't allow access outsize of your project directory tree, regardless of the file system permissions.

—SA
 
Share this answer
 
I think you are using window 7.Some time window 7 prevent the modification of the C drive files.So i suggest you to change the drive from C to D.This problem will definitely solved...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900