473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Trying to edit XML, error xml file is denied, how to i get access

So i have an xml file, i'm grabbing it via dataset, then placing the
data into a datagrid. everythings all good, but i'd like to edit the
data. the coding grabs whats in the edit textboxes, and should throw it
back to the xml file, but i get an error

"System.UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\work\xmlfile1.xml" 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 write 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."

please help, how can i permit access to edit the file, i've tried
going into the files properties and making sure its not read only, but
still, nothing.

Jan 3 '06 #1
1 3177
<jo**********@gmail.com> wrote in message news:11*********************@f14g2000cwb.googlegro ups.com...
"System.UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\work\xmlfile1.xml" 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. : : To grant ASP.NET write 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."

please help, how can i permit access to edit the file


The exception message explains how to grant write access to the file,
if you read the last paragraph more closely. The issue has nothing to
do with the read-only flag in the file system, it relates to Windows'
security privileges on that folder and file. You must configure the
folder to authorize ASP.NET so it can create files within the folder
(if this is a new file), and for the files you want ASP.NET to change
you must authorize ASP.NET to write them.

The "quick and dirty" solution is usually to add the ASP.NET user
(again, see the error message for what user name that is by default
based on the version of .NET and IIS you have installed) and
check the "Modify" checkbox on the folder (inherited by all
it's files and subfolders).

This is overkill, but effective enough for running code for learning
purposes. In a real world application you would define a specific
security policy involving a grant of access to the smallest set of
resources through a least privileges user account created just
for this individual application.

Please note that if you're running Win XP and you have the "simplified
sharing" feature turned on (the default regrettably being, "yes," although
it's right up there with the "hide system files" and "hide file extensions"
features [for greater user-friendliness] that all developers, IMHO, should
turn off immediately), then you will not see a Security tab when you
view a file's properties. See this Microsoft knowledge base article
for information on turning off "simplified sharing,"

http://support.microsoft.com/kb/307874/en-us
Derek Harmon
Jan 3 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Patrice FRITSCH | last post by:
I'm trying to run a batch file from an asp page using WScript.Shell object. Dim oWSH set oWSH= Server.CreateObject("WScript.Shell") call oWSH.Run("cmd.exe /c " & szCmd , 0, true) szCmd...
0
by: fritz | last post by:
Trying to get at mysql. I installed mysql on two separate machines and am unable to access either one. On the first I couldn't put it on C: because that was a limited DOS drive. So here is the...
3
by: Ian | last post by:
The beginning of my assembly that I am getting the access error from looks like this. ********************************* Imports System.EnterpriseServices Imports System Imports...
1
by: Ben Pryhoda | last post by:
I have already used a third party com object in my code, and it went easily. Add the reference, call the methods, and get my results. But I am integrating a legacy com object and I follow the...
5
by: tshad | last post by:
I am trying to access my log files and am running into a permissions problem. I am doing the following: ****************************************************************** private void...
12
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
7
by: Martin Strojek | last post by:
Hi, I have the following problem with developing some web site. I use Visual Studio 2003 to build a website. I tried Windows 2003 Server and switched now back to Windows XP with PWS but the...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.