Solved

Access to the path...is denied. When trying to load XML File

Posted on 2009-07-02
4
891 Views
Last Modified: 2012-05-07
URL : http://www.absolutedivorce.com/new/

Hi guys,

I am getting the followinf error when executing the code in the snippet:

Error : System.UnauthorizedAccessException: Access to the path 'D:\WWWRoot\absolutedivorce.com\www\new' 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.

Line 24:         m_document = new XmlDocument();

Line 25:         m_document.Load(schema);

Line 26:     }
 

This only occurs on my hosted space, it works fine locally tested. They claim that the IUSR user account has permission to read the folder in question and i have checked that the 2.0 framework is the target framework for this directory in the web folder.
 

Any suggesions?
 

Thanks
 

Apresto

Open in new window

0
Comment
Question by:apresto
  • 2
4 Comments
 
LVL 20

Expert Comment

by:informaniac
Comment Utility
Have u tried using <identity impersonate="false" /> in the web.config file
0
 
LVL 23

Author Comment

by:apresto
Comment Utility
Hi, thanks for the reply. Yes i put that in the web.config file in the sub directory where these files are and i got the same error. I put it here:
<authentication mode="Windows"/>
<identity impersonate="false" />

any other idea?
0
 
LVL 3

Accepted Solution

by:
sandip-mishra earned 500 total points
Comment Utility
hi....

i think you are assigning the "file name" to "schema"......

use it as follows

schema = server.MapPath("FIleLocation");

but before doing it you must have the file in the specified location.

Regards

Sandip Mishra
0
 
LVL 23

Author Comment

by:apresto
Comment Utility
That is spot on, i was referencing a file that didnt exist in my Server.Mappath, i didnt realise i hadnt uploaded it to the server, what a big headache for such a small mistake :)
Thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now