vb.net 如何让 windows 窗体应用程序以不同的用户身份运行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21587683/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make windows form application run as different user?
提问by merlot
I'm creating a simple file copy program on our intranet to allow users to copy a file to a specific network folder which they do not have access too. I plan to use the the "CopyFile" function from "My.Computer.FileSystem" Namespace since it will uses Windows built-in file copy dialog and progress bar. I assume the user needs to have authentication to this folder. I would like to know if I can have the program run as an authenticated user of this network folder for the file copy to work? Thank you.
我正在我们的 Intranet 上创建一个简单的文件复制程序,以允许用户将文件复制到他们也无权访问的特定网络文件夹。我计划使用“My.Computer.FileSystem”命名空间中的“CopyFile”函数,因为它将使用 Windows 内置的文件复制对话框和进度条。我假设用户需要对此文件夹进行身份验证。我想知道我是否可以让程序作为此网络文件夹的经过身份验证的用户运行,以便文件副本正常工作?谢谢你。
采纳答案by toATwork
You need to start a separate process for that. You can use Process.Start(...)
您需要为此启动一个单独的过程。您可以使用 Process.Start(...)
http://msdn.microsoft.com/en-us/library/sxf2saat%28v=vs.110%29.aspx
http://msdn.microsoft.com/en-us/library/sxf2saat%28v=vs.110%29.aspx
EDIT:
编辑:
based on your comment I did also a quick check up on impersonation. This from Matt Johnson post seems promising!
根据您的评论,我还对模拟进行了快速检查。这来自马特约翰逊的帖子似乎很有希望!

