ASP.NET 访问另一台计算机共享文件夹上的文件
我有 ASP.NET 项目,它执行一些文件访问和操作,我用于文件访问的方法如下。现在我需要访问另一台服务器共享文件夹上的文件,该怎么做?我可以轻松地将文件路径更改为共享文件夹路径,但出现“无法访问”错误,因为共享受密码保护。 据我了解,在执行下面的方法之前,我需要以某种方式将凭据发送到远程服务器。怎么做呢?
FileStream("c:\MyProj\file.doc", FileMode.OpenOrCreate, FileAccess.Write)
Context.Response.TransmitFile("c:\MyProj\file.doc");
问候, 托马斯
I have ASP.NET project which do some file access and manipulation, the methods which I use for file access are below. Now I need to access files on another server shared folder, how to do that? I easily can change file path to shared folder path but I get "can't access" error because shares are password protected.
As I understand I need somehow to send credentials to remote server before executing methods below. How to do that?
FileStream("c:\MyProj\file.doc", FileMode.OpenOrCreate, FileAccess.Write)
Context.Response.TransmitFile("c:\MyProj\file.doc");
Regards,
Tomas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ASP.NET 应用程序(默认情况下)将在 IIS6 中以“ASPNET”计算机帐户执行。因此,您有几个选择:
当然,后一个选项只有在您的用户都在 Intranet 上拥有域帐户的情况下才有用。我将继续寻找添加凭据的方法,但我不确定这是否可能。
HTH,
理查德。
An ASP.NET application (by default) will execute in IIS6 under the "ASPNET" computer account. You therefore have a couple of options:
The latter option is only useful, of course, if your users all have domain accounts on your intranet, for instance. I'll continue to look around for ways to add credentials but I'm not sure off the top of my head if that's possible.
HTH,
Richard.