UnauthorizedAccessException when reading XML files (no problem when reading other file-types)

B

blabla120

Hi NG,

I want to read a xml-file from an asp-page:

// Kategorien aus xml laden
string pathKategorien =
Server.MapPath("./conf/kategorien.xml");
FileStream fs = new FileStream(pathKategorien, FileMode.Open,
FileAccess.Read, FileShare.ReadWrite);
StreamReader sr = new StreamReader( fs );
XmlSerializer s = new XmlSerializer( typeof( Kategorien ) );
_kat = (Kategorien)s.Deserialize( sr );

I get the Exceptio "UnauthorizedAccessException".

But I am sure that the Access rights are properly set, becaus it is no
problem to read a text-File from the same folder:

string pathKategorien = Server.MapPath("./conf/textfile.txt");

So I suppose there must be something special about XML-file concerning
file access rights.

Does anyone have a hint for me?

Thanx, Bernd
 

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,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top