29
HttpContext.Current.Request.IsAuthenticated和HttpContext.Current.User.Identity.IsAuthenticated有什麼區別?HttpContext.Current.Request.IsAuthenticated和HttpContext.Current.User.Identity.IsAuthenticated有什麼區別?
你會在哪種情況下使用哪一種?
Thanks。它看起來像使用HttpContext.Current.Request.IsAuthenticated更好,因爲它檢查User等不爲null。 – Anthony 2009-09-04 14:28:20
Yeap,只需要確保HttpContext.Current.Request不爲null。 – 2009-09-04 14:30:40
只是一些挑剔的,但它不完全相同,因爲當用戶或用戶的身份爲空時,調用不可互換... – 2009-09-04 14:30:47