asp.net web.config impersonation vs application pool identity

我只是一个虾纸丫 提交于 2019-12-19 05:51:41

问题


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?

Another question, can you run a page under a separate identity from rest of the application?


回答1:


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.

<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.

 <identity impersonate="true" />

Source: MSDN

In case you're interested, here you have an article with a Identity matrix for different impersonate scenarios.

And yes, you can impersonate programatically as Alex Dn said




回答2:


1) In web.config.

2) You can do impersonation in code behind: http://support.microsoft.com/kb/306158

or Another article



来源:https://stackoverflow.com/questions/8745335/asp-net-web-config-impersonation-vs-application-pool-identity

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!