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

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. S. Justin Gengo
    Replies:
    0
    Views:
    853
    S. Justin Gengo
    Jul 14, 2003
  2. Rutger Smit
    Replies:
    1
    Views:
    543
    =?Utf-8?B?THVrZWI=?=
    Sep 6, 2004
  3. Anbu
    Replies:
    4
    Views:
    47,486
  4. Alona
    Replies:
    2
    Views:
    648
  5. Robert Altland
    Replies:
    0
    Views:
    307
    Robert Altland
    Sep 15, 2005
Loading...

Share This Page