简体   繁体   English

asp.net web.config模拟与应用程序池标识

[英]asp.net web.config impersonation vs application pool identity

If I impersonate a user in the web.config but the application runs under an application pool which uses another identity, which identity would be used when you access resources (say files) on the server? 如果我在web.config中模拟用户,但应用程序在使用其他身份的应用程序池下运行,那么在访问服务器上的资源(例如文件)时将使用哪个身份?

Another question, can you run a page under a separate identity from rest of the application? 另一个问题是,您可以在与其他应用程序不同的标识下运行页面吗?

When you access resources on the server the user will be the one specified on the impersonation configuration NOT the one on the application pool 当您访问服务器上的资源时,用户将是模拟配置中指定的用户,而不是应用程序池上的用户

Impersonation enabled for a specific identity. 模拟已启用特定身份。 In this instance, ASP.NET impersonates the token generated using an identity specified in the Web.config file. 在此实例中,ASP.NET模拟使用Web.config文件中指定的标识生成的标记。

<identity impersonate="true"
      userName="domain\user" 
      password="password" />

Impersonation enabled. 已启用模拟。 In this instance, ASP.NET impersonates the token passed to it by IIS, which is either an authenticated user or the anonymous Internet user account. 在此实例中,ASP.NET模拟IIS传递给它的令牌,IIS是经过身份验证的用户或匿名Internet用户帐户。

 <identity impersonate="true" />

Source: MSDN 资料来源: MSDN

In case you're interested, here you have an article with a Identity matrix for different impersonate scenarios. 如果您有兴趣, 这里有一篇文章,其中包含针对不同模拟场景的Identity矩阵。

And yes, you can impersonate programatically as Alex Dn said 是的,你可以像Alex Dn所说的那样以编程方式冒充

1) In web.config. 1)在web.config中。

2) You can do impersonation in code behind: http://support.microsoft.com/kb/306158 2)您可以在后面的代码中进行模拟: http//support.microsoft.com/kb/306158

or Another article 另一篇文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM