Im trying to save a file that i download from a mailbox. This hasnt been any problems, but now that i’v built a GUI upon my modell i get and Authorization exception:
Saved file: C:\TempNorlander
System.UnauthorizedAccessException: Access to the path 'C:\TempNorlander' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at a.a0.b(String A_0, Byte[] A_1, Int32 A_2, Int32 A_3)
at MailBee.Mime.Attachment.Save(String filename, Boolean overwrite)
at Mail2DB.Connect2Exchange.CollectData() in C:\Users\marthin\documents\visual studio 2010\Projects\Mail2DB\Mail2DB\Connect2Exchange.cs:line 210
I cant figure out what the problem is here. In the folder iv set all possible users have all priviliges.
EDIT:
I forgot to mention that now with the GUI i enter the folderpath in a simple textBox. (via a FolderBrowserDialog)
SECOND EDIT:
Im Runnig this on a windows 7 and VS 2010.
Thx for any help!
/Marthin
You are trying to save a file that has the same name as the folder. That’s not allowed, UnauthorizedAccessException is the result. Fix the file name to, say, C:\TempNorlander\mumble.txt