Page.User.Identity和Request.LogonUserIdentity之間有什麼區別(幕後)?不是類型,名稱等方面的差異,而是它們在後臺如何實現的區別(即一個調用windows xxx api,另一個調用asp.net xxx api ...)。Page.User.Identity與Request.LogonUserIdentity之間的差異
8
A
回答
18
這取決於您使用什麼機制來驗證用戶身份,以及您對模擬的設置。
例如,根據VS開發服務器,使用Forms身份驗證,標準的SQL成員資格提供以下代碼:
// m_LoggedIn is a Literal control on the page:
m_LoggedIn.Text = string.Format("<br />Page.User.Identity: {0} " +
"<br />Request.LogonUserIdentity: {1}",
Page.User.Identity.Name,
Request.LogonUserIdentity.Name);
我得到以下輸出:
Page.User。身份:zhaph
Request.LogonUserIdentity:[計算機] \奔
第一行(Page.User.Identity)是我登錄到網站的表單身份驗證帳戶,第二行是請求正在運行的Windows標識 - 因爲我沒有啓用模擬,這是我的Windows登錄,因爲這是運行Web服務器的帳戶。
在API的方面,HttpRequest.LogonUserIdentity被調用到的WindowsIdentity類,它將始終代表Windows用戶帳戶,而Page.User正在創造一個實現IPrinciple一個對象,它允許您使用數來表示用戶不同的後備存儲 - 例如由MembershipProvider提供的SQL數據庫結構。
相關問題
- 1. 列之間的SQL差異以及列與NULL值之間的SQL差異
- 2. NLS_NCHAR_CHARACTERSET abd NLS_CHARACTERSET與Oracle之間的差異
- 3. 視圖與ViewGroup之間的差異
- 4. VARCHAR2與NUMBER之間的性能差異
- 5. 導軌之間的區別與差異
- 6. Access-VBA 2010與2007之間的差異
- 7. int與整數之間的PHP差異
- 8. MVC 4 User.Identity.Name與WebSecurity.CurrentUserName之間的差異
- 9. JoinAlias與Joinquery之間對Rowcount的差異
- 10. iOS 7與iOS 7.1之間的差異
- 11. nuget-packing csproj與nuspec之間的差異
- 12. Java SE與Java EE之間的差異
- 13. 報表與表單之間的差異
- 14. NVL與Coalesce之間的Oracle差異
- 15. UIImagePickerController與iPhone和iPad之間的差異
- 16. Android View.getLeft()與View.getScrollX()之間的差異
- 17. ETL與vb.net和vb6之間的差異
- 18. skew()與skewX()之間的差異skewY()
- 19. 交付與交付之間的差異!
- 20. CAPICOM TripleDES與System.Security.Cryptography之間的差異TripleDES
- 21. .on()vs .one()與.trigger()之間的差異
- 22. Serilog:之間{..} {差異@ ..}
- 23. 當前時間戳與之前時間戳之間的差異
- 24. 差異*函數之間及與參數
- 25. /和/ **之間的差異
- 26. 兩次之間的差異
- 27. 差異之間的三個
- 28. PHP之間的差異()和[]
- 29. 行之間的Mysql差異
- 30. 行之間的差異
您似乎已經回答了您自己的問題。你有什麼特別的想法嗎? LogonUserIdentity返回當前登錄用戶的WindowsIdentity對象。 – sarvesh 2010-02-02 23:18:02