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.
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: 1897x