Intranet 站点页面的 Windows 身份验证
我正在构建一个具有 Windows 身份验证的 Intranet 网站 (asp.net 3.5)。两个问题:
- 当后面的代码与 SQL Server 建立可信连接时,它将与应用程序池凭据或当前页面用户凭据连接吗?
- 现在,当内部用户(登录到域)时,有一个空白页面)尝试访问他们遇到 Windows 登录屏幕挑战的页面,但他们的凭据不起作用。
除了添加
之外,我还需要在 web.config 或 IIS 中设置其他内容才能使 Windows 身份验证正常工作吗?
I'm building an intranet web site (asp.net 3.5) which has windows authentication. Two questions:
- When the code behind makes a trusted connection to the SQL server, will it connect with app pool credentials or current page user credentials?
- Right now, with a blank page, when the internal user (logged in to the domain) tries to hit the page they get challenged with windows login screen, and their credentials don't work.
Is there anything else I need to setup in web.config or IIS for the windows authentication to work, other than adding <authentication mode="Windows"/>
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过启用模拟将 ASP.NET 应用程序的 Windows 标识配置为 IIS 提供的 Windows 标识。也就是说,您指示 ASP.NET 应用程序模拟 IIS 为 Windows 操作系统验证的所有任务(包括文件和网络访问)提供的标识。
要为 Web 应用程序启用模拟,请在应用程序的 Web.config 文件中将标识元素的 impersonate 属性设置为 true,如以下代码示例所示。
来源
You can configure the Windows identity of your ASP.NET application as the Windows identity supplied by IIS by enabling impersonation. That is, you instruct your ASP.NET application to impersonate the identity supplied by IIS for all tasks that the Windows operating system authenticates, including file and network access.
To enable impersonation for your Web application, in the application's Web.config file set the impersonate attribute of the identity element to true, as shown in the following code example.
Source
您不想按照 kd7 的建议使用已由 kd7 解决。impersonate
。因为那时您将需要授予您的用户对数据库的权限。对于 SELECT 操作可能没问题,但如果您还需要 UDATE/DELETE 操作,我认为您的 DBA 不会同意。当您启用“Windows”身份验证时,您不仅需要配置应用程序以使用它,还需要配置 IIS。
您还需要确保您的 AppPool 用户对您站点的文件系统具有适当的权限。
根据 IIS 版本的不同,启用 Windows 身份验证的过程也有所不同。你可以谷歌一下。
You don't want to usealready addressed by kd7.imporsonate
as suggested by kd7. Because then you will need to give your users rights on the database. Might be okay for SELECT operations, but I don't think your DBAs will go along if you also need to UDATE/DELETE operations.When you enable "Windows" authentication, you need to not only configure your application to use it, you also need to configure IIS as well.
You also need to make sure that your AppPool user has proper permissions on the File System for your site.
Depending on IIS version, the procedure for enabling windows authentication is different. You can google it.