Solved

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

Posted on 2009-07-02
4
921 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 20

Expert Comment

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

Author Comment

by:apresto
ID: 24761777
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
ID: 24769795
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
ID: 24923036
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 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