?
Solved

Write into file from a Handler - UnauthorizedAccessException

Posted on 2009-02-09
2
Medium Priority
?
271 Views
Last Modified: 2012-05-06
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
0
Comment
Question by:andre72
2 Comments
 
LVL 15

Accepted Solution

by:
Praveen Venu earned 1000 total points
ID: 23592638
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
 

Author Closing Comment

by:andre72
ID: 31544622
Works for me, thanks a lot!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question