Access to the path...is denied error

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.
 
B

Bruce W...1

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top