使用 C# 对客户端应用程序的 Windows Server 进行身份验证的方法

发布于 2024-08-03 06:05:57 字数 478 浏览 2 评论 0原文

我有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放赐 2024-08-10 06:05:57

您需要使用模拟。

以下知识库文章提供了一些有关使用 .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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文