所以在C#中我试图访问网络上的文件,例如"@applications/myapp/test.txt",如下所示:
const string fileLocation = @"//applications/myapp/test.txt";
using (StreamReader fin = new StreamReader(FileLocation))
{
while(!fin.EndOfStream()){
//Do some cool stuff with file
}
}
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
System.IO.IOException : Logon failure: unknown user name or bad password.
Run Code Online (Sandbox Code Playgroud)
我认为它是因为我需要提供一些网络凭证,但我不知道如何让这些在这种情况下工作.
有没有人知道访问受密码保护的位置上的这些文件的最佳方式(或任何方式)?
提前致谢!!