Solved

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

Posted on 2009-07-02
4
933 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 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