开发者

UnauthorizedAccessException when reading from Application Directory

I am trying to read translation files from the application directory, but the call to open a Stream fails:

fstream = new FileStream(path, FileMode.Open);
开发者_如何学编程

I don't quite understand why, as the user persmissions for the file are present.

Does anybody know a way to overcome this?

many thanks in advance,

Philip

EDIT:

I finally found the answer myself. The FileStream accepts another parameter which defnies the file access (FileAccess.Read in this case):

fstream = new FileStream(path, FileMode.Open, FileAccess.Read);

With this modification it works just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜