Write into file from a Handler - UnauthorizedAccessException

Hi,

I've a Handler for my web application and try to write to a file:
ds.WriteXml(HttpContext.Current.Server.MapPath("~/test.xml"));

The response is ever, that I've no rights to write there - UnauthorizedAccessException ...
The path is right in the error message: "C:\inetpub\wwwroot\webapp\test.xml"

How can I solve this problem?

Thanks,
Andre
andre72Asked:
Who is Participating?
 
Praveen VenuTechnical Project ManagerCommented:
This is because the ASPNET account and the NETWORK SERVICE account do not have the correct permissions..

Right click the folder webapp and select properties. Then add all rights to ASPNET and NETWORK SERVICE users
0
 
andre72Author Commented:
Works for me, thanks a lot!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.