Get file to FileStream from remote path with another user credentials

老子叫甜甜 提交于 2019-11-29 07:49:00

Thank you for your answers. Since the share was in another domain, it was not so easy to impersonate.

I found another, easier solution. I mapped a network drive, and checked the option Connect using different credentials. Then I connect to this drive instead of the remote path.

string mappedFilePath = filePath.Replace(@"\\computername\", @"Y:\")

and use this new string in FileStream constructor.

You should use impersonation. More info at http://msdn.microsoft.com/en-us/library/w070t6ka.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!