ASP.NET尝试通过UNC访问网络文件夹

the*_*mhz 1 vb.net asp.net asp.net-mvc

您好我正在尝试从我的ASP.NET Intranet Web应用程序访问网络文件夹.这是我的代码

Dim di As DirectoryInfo = New DirectoryInfo("\\10.11.11.172\testfolder")
Dim subFiles() As FileInfo = di.GetFiles()
Run Code Online (Sandbox Code Playgroud)

我明白了

Access to the path '\\10.11.11.172\testfolder\' is denied.
Run Code Online (Sandbox Code Playgroud)

如何输入我的用户名和密码才能使其正常工作?

Be.*_*St. 5

您的Web应用程序正在使用NETWORK SERVICE帐户运行.
您必须模拟用户访问网络共享.
您可以在web.config中设置它,查看标识元素(ASP.NET设置架构)