【发布时间】:2020-06-16 12:52:43
【问题描述】:
我正在使用 asp.net core 2.2 和 angular 9 开发一个内部 Web 应用程序。我希望访问位于同一 Windows 服务器域中的公司文件服务器,以便上传、下载或仅列出以下内容目录。你有办法在本地或使用库吗?
提前谢谢,我有点迷路了。
更新: 我找到了这个方法,但我有错误“访问被拒绝”:
NetworkCredential sourceCredentials = new NetworkCredential { Domain = "domain_name", UserName = "username", Password = "pass" };
try
{
NetworkConnection.NetworkConnection con =
new NetworkConnection.NetworkConnection(@"server_destination_directory", sourceCredentials);
using (con)
{
Console.WriteLine();
System.IO.File.Copy(@"server_destination_directory", @"file_to_copy", true);
}
}catch(Exception e)
{
return NotFound(e);
}
权限没问题,我激活了windows和匿名认证,问题出在哪里?
【问题讨论】:
标签: angular asp.net-core windows-server network-drive