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

标签 .net asp.net authentication impersonation windows-authentication

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

身份验证是实现这一目标的方法吗,我该怎么做?

最佳答案

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

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

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

关于.net - 使用 Windows 身份验证时如何模拟另一个 Windows 用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1862526/

相关文章:

c# - 如何使用 C# 从字符串中提取子字符串?

.net - VB.NET 下字符串的默认编码是什么?

php - 加载带有身份验证的 xml 文件(并提高安全性)

java - 在 login.class 上验证时,来自共享首选项的数据不正确

c# - 如何管理用户 claim ?

c# - 在 TextBlock 中将文本环绕在图像周围

c# - 在Unity容器中将null注册为实例

c# - 如何使用 <asp :scriptreference> in asp.net 4.5 包含最新的 Jquery?

javascript - 使电子邮件正则表达式以逗号分隔

c# - 无法访问 asp :TextBox tag from the C# file : the name 'txtUsername' does not exist in the current context