Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

Upon trying to save an XmlDocument file, ASP.NET tells me that

access is denied and that I cannot save over a file. This is the error:

 

The ASP.NET process is not authorized to access the requested resource. For security reasons the default ASP.NET process identity is '{machinename}\ASPNET', which has limited privileges. Consider granting access rights to the resource to the ASP.NET process 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 "{machinename}\ASPNET" user. Highlight the ASP.NET account, and check the Write box in the Allow column.

 

Now I'm on Windows XP Pro, and nowhere do I see a place to

change the security options for the file. I also looked in the

ASP.NET service options in admin tools, but no luck.

 

How do I allow my ASP.NET app access to save the file?

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • *Experts*
Posted (edited)

Okay, I found something out...

I'm using one XML file, data.xml, to store data in my app.

Each of the pages in the app loads data.xml into an XmlDocument

object (xd.Load(path)). Now when I acces this page directly once,

it updates the file. But every acces after that, the error occurs.

 

Now there are no errors Loading the file, only for Saving... So I

think the question now is how do I close the XmlDocument after

loading it?

 

I'm all confused now. :(

 

[edit]One last thing... If I Load and Save data1.xml (just a copy of

data.xml for testing), it works perfectly... So maybe I need to

Save every time I Load an XmlDocument in the other pages,

even if the XmlDocument isn't modified?[/edit]

Edited by Bucky

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • *Experts*
Posted

Whew, I figured it out. Apparently my app can only write over the

file if it was created by that app. So I copied the XML file under

a new name, then deleted the original. Then I temporarily

changed the code to have it read from the copy and write to the

filename I wanted. Then I changed everything back, and it works

like a charm.

 

Who woulda thunk? :)

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...