Wrox Programmer Forums
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 4th, 2004, 09:05 AM
Registered User
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Noob needs help.

I'm all new to ASP.NET so I'm going to need lots of help . I'm trying to create a Guestbook and I've put the guestbook1.aspx and guestbook1.xml into C:\Inetpub\wwwroot\daniel\. When I'm trying to run the guestbook.aspx all works fine until I hit submit and I get this message:

Access to the path "c:\inetpub\wwwroot\daniel\guestbook1.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\daniel\guestbook1.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.

Source Error:

Line 38: // Insert the new element into the XML tree and save
Line 39: myXmlDocument.DocumentElement.InsertBefore(myXmlEl ement, myXmlNode);
Line 40: myXmlDocument.Save(Server.MapPath("guestbook1.xml" ));
Line 41:
Line 42: // Re-bind data since the data has changed.

Source File: c:\inetpub\wwwroot\daniel\guestbook1.aspx Line: 40

Stack Trace:

[UnauthorizedAccessException: Access to the path "c:\inetpub\wwwroot\daniel\guestbook1.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) +888
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +45
   System.Xml.XmlDocument.Save(String filename) +91
   ASP.guestbook1_aspx.GuestbookPost_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\daniel\guestbook1.aspx:40
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1277"

The problem is I don't know how to grant access rights to the file, because I think I've tried most things in ISS and I don't even have a security tab if I right click the file in explorer. Is there anything else than brains I migt have missed during installation perhaps? I have frameworks SDK and SQL server 2000 installed. Help plz!

Old July 4th, 2004, 10:18 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi Daniel,

Check out this FAQ: http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=290

It will explain how you can change your security settings, and it contains a link to another FAQ that explains how to get the Security tab back.


Imar Spaanjaars
Everyone is unique, except for me.
Old July 4th, 2004, 03:39 PM
Registered User
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Imar, what can I say? Elvis has left the building and we have a new king.

1000 Thanks!

Sincerly yours,


Old March 19th, 2006, 06:38 PM
Registered User
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts


Again, this post was of great help, however...

I had to add this line to my web.config file to get everything to work:

<identity impersonate="true">

Perhaps this is a "quick fix" - at this point I'm just happy it works.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perplexed noob mona_in ASP.NET 1.0 and 1.1 Basics 1 July 21st, 2008 09:19 AM
Help a noob wilbo BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 April 22nd, 2008 11:54 AM
noob question mattl Java Basics 1 August 27th, 2007 11:28 PM
Noob Needs Help -XM- BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 3 June 28th, 2007 04:53 PM
Noob Question jverdin BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 3 April 2nd, 2004 10:01 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.