469,612 Members | 1,674 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,612 developers. It's quick & easy.

Cannot write XML

I am having trouble writing an XML file out on my
localhost development machine.

I get:
Server Error in '/ProblemSolved' Application.
-----------------------------------------------------------
---------------------

Access to the
path "c:\inetpub\wwwroot\ProblemSolved\XMLData\Products .xml
" is denied.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.UnauthorizedAccessException:
Access to the
path "c:\inetpub\wwwroot\ProblemSolved\XMLData\Products .xml
" is denied.

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.

Source Error:
Line 101:
Line 102: private void SaveProducts() {
Line 103: _dsProducts.WriteXml
(Server.MapPath("../XMLData/Products.xml"));
Line 104: }
Line 105:
Source File:
c:\inetpub\wwwroot\problemsolved\maintenance\produ cts.aspx.
cs Line: 103

Stack Trace:
[UnauthorizedAccessException: Access to the
path "c:\inetpub\wwwroot\ProblemSolved\XMLData\Products .xml
" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String
str) +393
System.IO.FileStream..ctor(String path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize,
Boolean useAsync, String msgPath, Boolean bFromProxy) +859
System.IO.FileStream..ctor(String path, FileMode mode,
FileAccess access, FileShare share) +45
System.Xml.XmlTextWriter..ctor(String filename,
Encoding encoding)
System.Data.DataSet.WriteXml(String fileName,
XmlWriteMode mode)
System.Data.DataSet.WriteXml(String fileName)
ProblemSolved.Maintenance.Products.SaveProducts() in
c:\inetpub\wwwroot\problemsolved\maintenance\produ cts.aspx.
cs:103

ProblemSolved.Maintenance.Products.dgProducts_Item Command
(Object source, DataGridCommandEventArgs e) in
c:\inetpub\wwwroot\problemsolved\maintenance\produ cts.aspx.
cs:128
System.Web.UI.WebControls.DataGrid.OnItemCommand
(DataGridCommandEventArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject
source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source,
EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt
(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source,
EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand
(CommandEventArgs e)

System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBac
kEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
I am running on XP Professional.

What I have tried:
- right-click the file in Explorer, choose "Properties"
and select the Security tab. --> There is NO such tab. I
am given General, Sharing, WebSharing
- I have made sure both the directory and file are NOT
read-only
- I have given the ASPNET account Administrator
priveledges.
- I have set the "local Intranet" security to FULL access -
no restrictions.
- I have set the DLL security to FULL access - no
restriction
- I have shared out the drive with no restrictions
(read/write permission)
- I have shared out the directory with no restrictions
(read/write permission)
- I have read every one else's suggestions and (like most
people with this problem). Switching to Windows Server
2003 is not an option at this time (down the road fine,
but I have customers who aren't going to switch just
because I have this little problem)

I am completely stymied and have been unable to get around
this for the past several days. PLEASE somebody help me -
I am dead in the water and have been for several days. I
really don't want to give up on XML and switch to a
database for this application and I really really really
don't want to have to go back to J2EE. But I may have to
if I can't find a solution.

Nov 11 '05 #1
0 2860

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Christopher Brandsdal | last post: by
2 posts views Thread by Jim in Arizona | last post: by
reply views Thread by LamSoft | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.