2013-09-27 32 views
0

我只是閱讀有關暫時冒充在ASP.Net臨時模擬的Windows身份驗證的用戶在ASP.Net

用戶在http://msdn.microsoft.com/en-us/library/ff647405.aspx

要做到這一點下面的代碼使用。

//暫時模仿原始用戶。

WindowsImpersonationContext wic = wi.Impersonate(); 
try 
{ 
    // Access resources while impersonating. 
} 
catch 
{ 
    // Prevent exceptions propagating. 
} 
finally 
{ 
    // Revert impersonation. 
    wic.Undo(); 
} 

我使用Windows Server 2008和有一個應用程序池,只是想cofirm,當我不使用上面的代碼默認冒充該服務隨後將用我的身份是什麼我已經爲集我的應用程序池。

問題是,我想這取決於如果用戶通過Windows應用程序登錄或使用ASP.Net窗體身份驗證 感謝

回答

4

這是我所知道正確的資源不同的安全訪問。如果您沒有模仿作爲調用用戶,默認情況下它應該以應用程序池的默認身份運行。

============================================== =================================

下面是一些很好的鏈接,你可以通過這些來了解IIS用戶

總結:

  • IIS 5.1(Windows XP中) - 這是一個本地ASPNET帳戶
  • IIS 6 - 默認情況下,網絡服務帳戶是IIS_WPG的成員下運行的應用程序池組
  • IIS 7.0 - 仍然網絡服務
  • IIS 7 SP2/7.5 - 運行在名爲ApplicationPoolIdentity的短暫事件下,映射到帳戶IIS APPPOOL \ ApplicationPool(例如, IIS APPPOOL \ DefaultAppPool)。此帳戶是IIS_IUSRS用戶組的成員

信息來源來源: -

用戶ASP.NET 下運行什麼是所有用戶帳戶爲IIS/ASP.NET和它們有什麼不同?

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://imar.spaanjaars.com/287/how-do-i-determine-the-security-account-that-iis-uses-to-run-my-web-site

來源:謝加 - In which Account By Default ASP.NET 4.0 Code Execute?