This is not related to your code per se. Access is denied. This directory is not accessible by ASP.NET. You can only work with files under the root directory of your site. To get a correct path to a physical file system object corresponding to a site's virtual path, use
System.Web.HttpServerUtility.MapPath
:
http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx[
^].
Also, working with XML like you do is not a mistake, but it rarely makes sense. In most cases, you can use
serialization, in particular,
Data Contract, which is the most robust, unobtrusive and easy to use way to persist any object or object graph:
http://msdn.microsoft.com/en-us/library/ms973893.aspx[
^],
http://msdn.microsoft.com/en-us/library/ms733127.aspx[
^].
—SA