Hallo,
ich habe ein Problem bei einer Exception. Ich versuche in meinem Programm die Dateinamen von Dateien einer bestimmten Endung abzufragen:
Wenn ich das Programm von einem lokalen Laufwerk aus starte, funktioniert alles wunderbar. Starte ich es jedoch von einem Netzwerklaufwerk, kommt folgendes:
Kann mir evtl. jemand helfen?
ich habe ein Problem bei einer Exception. Ich versuche in meinem Programm die Dateinamen von Dateien einer bestimmten Endung abzufragen:
Code:
DirectoryInfo dir = new DirectoryInfo(@workingDirPath.Text);
FileInfo[] csvfiles = dir.GetFiles("*.csv");
Wenn ich das Programm von einem lokalen Laufwerk aus starte, funktioniert alles wunderbar. Starte ich es jedoch von einem Netzwerklaufwerk, kommt folgendes:
Code:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.DirectoryInfo..ctor(String path)
at GUI.Start.workingDir(Boolean showDlg)
at GUI.Start.btn_Start_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at User.Sys.start_new_form()
at User.Sys.Main()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The Zone of the assembly that failed was:
Intranet
Kann mir evtl. jemand helfen?