Access to the path...is denied error

  • Thread starter Thread starter Bruce W...1
  • Start date Start date
B

Bruce W...1

Running Windows 2000 Server here. My ASP.NET app reads an XML file (in
the virtual root on the local machine) like this just fine:
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("feeds.xml"),XmlReadMode.InferSchema);

The problem is when I upload it to my host I get a
System.Security.SecurityException when trying to read the XML file. But
you've heard this all before. So I thought I'd try replacing the
dataset reader with a FileStream like this:
DataSet ds = new DataSet();
FileStream fs = new FileStream(Server.MapPath("feeds.xml"),
FileMode.Open);
ds.ReadXml(fs, XmlReadMode.InferSchema);
So now it gives me, on my local machine, an "Access to the path...is
denied" error?!

Same directory, same XML file, one has access and the other does not.
Can you explain this???

I am not impersonating in web.config.

Many people might suggest changing folder and file permissions. That's
fine, except when it comes to my hosting company. I can't access these
things there.

There's just gotta be a way to change security setting in the
web.config, but I can't figure how.

Does anyone know how to fix any of these errors?

Thanks for your help.
 
Never mind. I fixed it. And you would never guess how so I'll tell
you.

Apparently at my hosting company new ASP.NET are, by default, configured
for the 1.0 Framework. I found an option in the host control panel to
upgrade a site to 1.1. After doing this everything works fine. Who
woulda thunk it?
 
Back
Top