我有两台没有密码的计算机连接到无线网络。
文件在计算机 A 上,程序在计算机 B 上。
从操作系统我可以毫无问题地访问和修改 B 中的 A 中的文件:
当我运行程序时:
using (StreamReader sr = new StreamReader("\\\\VIERNES7-3\\Documentos c\\tables\\tableOrders"))
{
String line;
while ((line = sr.ReadLine()) != null)
{
activeTables.Add(int.Parse(line));
}
}
它给了我以下例外:
No se controló System.UnauthorizedAccessException
Message=Access to the path '\\VIERNES7-3\Documentos c\tables\tableOrders' is denied.
Source=mscorlib
StackTrace:
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, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path)
at cocina2.Table.ActiveTables() in C:\Users\Trufa\documents\visual studio 2010\Projects\Viernes 7\cocina2\Table.cs:line 16
at cocina2.Form1.paintListViews() in C:\Users\Trufa\documents\visual studio 2010\Projects\Viernes 7\cocina2\Form1.cs:line 46
at cocina2.Form1.refresh() in C:\Users\Trufa\documents\visual studio 2010\Projects\Viernes 7\cocina2\Form1.cs:line 247
at cocina2.Form1..ctor() in C:\Users\Trufa\documents\visual studio 2010\Projects\Viernes 7\cocina2\Form1.cs:line 23
at cocina2.Program.Main() in C:\Users\Trufa\Documents\Visual Studio 2010\Projects\Viernes 7\cocina2\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
我不确定是什么问题,因为我似乎已获得授权。