RSS registrovat login
Navigace: předchozí stranaúvodní strana
UnauthorizedAccessException in desktop application

One our desktop application did not work when it tried to access data on shared network folder, even if user had rights to read from it. UnauthorizedAccessException was thrown with error message Access to the path '\\server\folder\file' is denied. When you try to find this problem, it is quite often related to web applications, but what about desktop application (this one was WPF, .Net framework 4)?

The problem is that FileStream is opening files for read/write access by default, so it does not work when folder is shared for reading only. Solution is to specify the access mode for reading, e.g.

stream =
new
FileStream(filename, FileMode.Open, FileAccess.Read);

Syntax higlighted by Syntax highlighter, available at www.4ITDevelopers.net and www.JakNaWin.com


Informace ke stavu builder.cz zde


vytvořil Mi.Chal. 21.5. 2011 12:54, naposledy změněnil Mi.Chal. 21.5. 2011 12:56
přečteno: 1753x

Komentáře:
Žádné komentáře dosud nebyly vloženy.

Přidat komentář:
Jméno
E-mail
Web
Titulek
Obsah
thomas sabo rea mbt outlet thomas sabo charms sale louis vuitton taschen kaufen thomas sabo boutique mbt kaufen