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

Discussion in 'ASP .Net' started by blabla120@gmx.net, Sep 15, 2006.

  1. Guest

    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
     
    , Sep 15, 2006
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anbu
    Replies:
    4
    Views:
    48,263
  2. jkflens
    Replies:
    2
    Views:
    1,735
    jkflens
    May 30, 2006
  3. Alona
    Replies:
    2
    Views:
    768
  4. Robert Altland
    Replies:
    0
    Views:
    406
    Robert Altland
    Sep 15, 2005
  5. MikeL
    Replies:
    2
    Views:
    451
    Dino Chiesa [Microsoft]
    Feb 22, 2005
  6. Brendon
    Replies:
    4
    Views:
    1,010
    Chris Carter
    Feb 13, 2007
  7. Erik Wasser
    Replies:
    5
    Views:
    845
    Peter J. Holzer
    Mar 5, 2006
  8. Replies:
    5
    Views:
    353
    Chris Angelico
    May 14, 2014
Loading...