[英]Temporarily impersonate the Windows authenticated user in ASP.Net
I'm just reading about temporarily impersonating a user in ASP.Net 我只是在阅读有关在ASP.Net中临时模拟用户的信息
at http://msdn.microsoft.com/en-us/library/ff647405.aspx 在http://msdn.microsoft.com/en-us/library/ff647405.aspx
To achieve this the following code is used. 为此,使用以下代码。
// Temporarily impersonate the original user. //临时模拟原始用户。
WindowsImpersonationContext wic = wi.Impersonate();
try
{
// Access resources while impersonating.
}
catch
{
// Prevent exceptions propagating.
}
finally
{
// Revert impersonation.
wic.Undo();
}
I am using Windows Server 2008 and have an application pool and just wanted to cofirm that when I am not impersonating by using the above code by default the service will then use the identity of my what I have set for my application pool. 我正在使用Windows Server 2008,并且有一个应用程序池,只是想确认一下,当我默认不使用上述代码进行模拟时,该服务将使用我为应用程序池设置的身份。
Issue is I want a different security access to resources depending on if the user logged in via windows application or used ASP.Net forms authentication Thanks 问题是,我希望对资源进行不同的安全访问,具体取决于用户是否通过Windows应用程序登录或使用过ASP.Net表单身份验证。谢谢
That is by what I know correct. 据我所知,这是正确的。 If you do not impersonate as the calling user, by default it should run under the default identity from the application pool.
如果您不冒充主叫用户,则默认情况下,它应以应用程序池中的默认身份运行。
=============================================================================== ================================================== =============================
Below are some good links you can go through these to understand the iis user 以下是一些不错的链接,您可以通过这些链接来了解iis用户
In summary: 综上所述:
Infomation source:- 信息来源:
User ASP.NET runs under What are all the user accounts for IIS/ASP.NET and how do they differ? 用户ASP.NET在IIS / ASP.NET的所有用户帐户下运行,它们有何不同?
http://www.bluevisionsoftware.com/WebSite/TipsAndTricksDetails.aspx?Name=AspNetAccount http://www.bluevisionsoftware.com/WebSite/TipsAndTricksDetails.aspx?Name=AspNetAccount
http://www.iis.net/learn/get-started/planning-for-security/understanding-built-in-user-and-group-accounts-in-iis http://www.iis.net/learn/get-started/planning-for-security/understanding-built-in-user-and-group-accounts-in-iis
http://imar.spaanjaars.com/287/how-do-i-determine-the-security-account-that-iis-uses-to-run-my-web-site http://imar.spaanjaars.com/287/how-do-i-determine-the-security-account-that-iis-uses-to-run-my-web-site
Source: Shekhar - In which Account By Default ASP.NET 4.0 Code Execute? 来源:Shekhar- 默认情况下在哪个帐户中执行ASP.NET 4.0代码?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.