Solved

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

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Master Content Pages, WebForms, and Session Variables 1 45
IIS Authorization for Web Service 2 46
Reset asp.net login password 4 42
ASP.NET MVC -Add authentication 2 21
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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 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