使用 C# 对客户端应用程序的 Windows Server 进行身份验证的方法
我有 Windows Server 2003 机器作为我们网络的一部分。我已经在上面创建了一个管理员用户。
现在这个服务器系统有一个共享文件夹。
我正在编写一个 C# 应用程序,它将本地系统的一些文件复制到 Windows Server 2003 计算机中的共享文件夹。
我已经编写了文件传输代码,如果我使用 Windows 资源管理器对客户端计算机进行身份验证以将文件复制到服务器上的共享文件夹中,则效果很好。
但是,如果我不使用 Windows 资源管理器进行身份验证,我的代码会出现“访问被拒绝”错误。
我想要 C# 工具,它可以验证我的文件传输应用程序,而无需每次在 Windows 资源管理器上输入凭据。 Windows 服务器具有正常的 Windows 身份验证。
请帮忙!!
编辑-
服务器没有 AD,请注意,我正在针对 AD 进行身份验证,我只想创建到计算机的经过身份验证的 Windows 会话。
I have windows server 2003 machine as a part of our network. I have created an administrator user on it.
Now this server system has a shared folder.
I am writing a C# application which will copy some files a local system to that shared folder in the windows server 2003 machine.
I have coded the file transfer code, it works fine if I authenticate the client machines using windows explorer to copy file into the shared folder on the server.
However If I don't authenticate using windows explorer my code gives Access Denied Error.
I want C# cope piece which can authenticate my file transfer application without entering the creds on windows explorer each time. The windows server has normal windows authentication.
Please help!!
Edit-
The server does not have an AD, please note that Iam authenticating against an AD, I just want to create an Authenticated windows session to the machine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用模拟。
以下知识库文章提供了一些有关使用 .NET 模拟的有用信息:
http://support.microsoft.com/default.aspx? scid=kb;en-us;Q306158
快速 Google 搜索会出现以下示例(基于相同的想法):
http://www.codeproject.com/KB/cs/cpimpersonation1.aspx
You need to use impersonation.
The following KB article has some good information on using impersonation from .NET:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q306158
A quick Google search turns up the following example (based on the same idea):
http://www.codeproject.com/KB/cs/cpimpersonation1.aspx