使用 Windows 身份验证时如何模拟另一个 Windows 用户?

发布于 2024-08-14 01:20:54 字数 131 浏览 3 评论 0原文

我有一个 ASP.NET 应用程序,其中只有通过 Windows 身份验证的用户(即登录用户)才能访问大多数页面。现在,我的客户希望能够通过此应用程序使用自定义登录对话框/页面“登录”。

身份验证是实现此目的的方法吗?我该如何进行?

I have an ASP.NET application where only users authenticated by Windows (i.e. logged on user) have access to most pages. Now, my client wants to be able to 'log on' through this app, with a custom login dialogue/page.

Is Authentication the way to achieve this, and how do I go about it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

温柔戏命师 2024-08-21 01:20:54

使用表单身份验证有什么问题?

如果您还需要模拟,您可以将 web.config 中的 identity 元素中的 impersonate 属性设置为 true,但从您提到的情况来看,它不需要听起来你根本不需要模仿。

What's wrong with using Forms Authentication?

You can set the the impersonate attribute in the identity element in your web.config to true if you need impersonation as well, but from what you've mentioned, it doesn't sound like you need impersonation at all.

画离情绘悲伤 2024-08-21 01:20:54

您可以创建一个界面来接受您的用户登录信息并使用以下内容创建新凭证:

NetworkCredential credentials = new NetworkCredential("username", "password");

并使用此凭证来访问您的安全资源。

You can create an interface to accept your user login info and to create a new crdential with this:

NetworkCredential credentials = new NetworkCredential("username", "password");

And use this credential to access your secured resource.

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