在Application_AuthenticationRequest的global.asax文件中,我將Thread.CurrentPrincipal設置爲自定義主體。我也將HttpContext.Current.User設置爲相同的主體。Application_AuthenticationRequest中設置的Thread.CurrentPrincipal稍後未在應用程序中設置
但是,在我需要將Thread.CurrentPrincipal強制轉換爲我們的自定義類型時,出現運行時錯誤: 無法強制類型爲'System.Web.Security.RolePrincipal'的對象輸入'OurCustomPrincipal 」。
怎麼將得到Thread.CurrentPrincipal中重置RolePrincipal,多到我如何保持它在CustomPrincipal點我們在Global.asax設置
在此先感謝
這纔剛剛開始發生。不知道爲什麼。加入``解決了這個問題。 –
tugberk
2013-06-05 11:38:10