jpopesku
08-04-2004, 07:17 AM
Hey all. I'm attempting to create a (or rather tweak someone else's) guestbook that uses xml. I have everything working nicely except for when I try to post a new entry. Reading from the file is not a problem, but writing is. The error is:
[quote]
Accesstothepath"E:\web\teamendoca0\htdocs\Community\guestbook.xml"isdenied.
Description:Anunhandledexceptionoccurredduringthee xecutionofthecurrentwebrequest.Pleasereviewthestac ktraceformoreinformationabouttheerrorandwhereitori ginatedinthecode.
ExceptionDetails:System.UnauthorizedAccessExceptio n:Accesstothepath"E:\web\teamendoca0\htdocs\Community\guestbook.xml"isdenied.
ASP.NETisnotauthorizedtoaccesstherequestedresource .ConsidergrantingaccessrightstotheresourcetotheASP .NETrequestidentity.ASP.NEThasabaseprocessidentity (typically{MACHINE}\ASPNETonIIS5orNetworkServiceon IIS6)thatisusediftheapplicationisnotimpersonating. Iftheapplicationisimpersonatingvia<identityimpersonate="true"/>,theidentitywillbetheanonymoususer(typicallyIUSR_M ACHINENAME)ortheauthenticatedrequestuser.
TograntASP.NETwriteaccesstoafile,right-clickthefileinExplorer,choose"Properties"andselecttheSecuritytab.Click"Add"toaddtheappropriateuserorgroup.HighlighttheASP.NET account,andchecktheboxesforthedesiredaccess.
SourceError:
Line36://InsertthenewelementintotheXMLtreeandsave
Line37:myXmlDocument.DocumentElement.InsertBefore( myXmlElement,myXmlNode);
Line38:myXmlDocument.Save(Server.MapPath("guestbook.xml"));</fontid="red">
Line39:
Line40://Re-binddatasincethedatahaschanged.
</CODE>
I currently have the .xml file stored in the root directory. Should I be keeping it somewhere else that allows write-access to the file?
Thanks for your help.
JP
[quote]
Accesstothepath"E:\web\teamendoca0\htdocs\Community\guestbook.xml"isdenied.
Description:Anunhandledexceptionoccurredduringthee xecutionofthecurrentwebrequest.Pleasereviewthestac ktraceformoreinformationabouttheerrorandwhereitori ginatedinthecode.
ExceptionDetails:System.UnauthorizedAccessExceptio n:Accesstothepath"E:\web\teamendoca0\htdocs\Community\guestbook.xml"isdenied.
ASP.NETisnotauthorizedtoaccesstherequestedresource .ConsidergrantingaccessrightstotheresourcetotheASP .NETrequestidentity.ASP.NEThasabaseprocessidentity (typically{MACHINE}\ASPNETonIIS5orNetworkServiceon IIS6)thatisusediftheapplicationisnotimpersonating. Iftheapplicationisimpersonatingvia<identityimpersonate="true"/>,theidentitywillbetheanonymoususer(typicallyIUSR_M ACHINENAME)ortheauthenticatedrequestuser.
TograntASP.NETwriteaccesstoafile,right-clickthefileinExplorer,choose"Properties"andselecttheSecuritytab.Click"Add"toaddtheappropriateuserorgroup.HighlighttheASP.NET account,andchecktheboxesforthedesiredaccess.
SourceError:
Line36://InsertthenewelementintotheXMLtreeandsave
Line37:myXmlDocument.DocumentElement.InsertBefore( myXmlElement,myXmlNode);
Line38:myXmlDocument.Save(Server.MapPath("guestbook.xml"));</fontid="red">
Line39:
Line40://Re-binddatasincethedatahaschanged.
</CODE>
I currently have the .xml file stored in the root directory. Should I be keeping it somewhere else that allows write-access to the file?
Thanks for your help.
JP