今天我有一個真正糟糕的WebForms日!WebForms表單身份驗證:成功登錄並重定向後Request.IsAuthenticated = false
我有一個使用Forms Authentication的成熟WebForms Web應用程序。由於某種未知的原因,我的應用程序已經開始顯示Request.IsAuthenticated
(在Global.asax
的Application_BeginRequest
功能),儘管進入登錄頁面,登錄成功,並呼籲FormsAuthentication.RedirectFromLoginPage()
。
我只是不能解決出了什麼問題。這是我所做的檢查。我希望有人可能會指出一些我沒有到過這裏:
的
web.config
認證部分如下:<authentication mode="Forms"> <forms loginUrl="~/Login" timeout="120" cookieless="UseCookies" defaultUrl="~/ExitPoint.aspx?Page=Home" /> </authentication>
的
web.config
授權部分如下:<authorization> <deny users="?" /> <allow users="*" /> </authorization>
對於如登錄/註銷頁面我有:
<location path="Login"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location>
當登錄時,我有了突破,並逐步完成了身份驗證過程。這結束了與:
FormsAuthentication.RedirectFromLoginPage(userID, createPersistentCookie: true); // Includes call to SetAuthCookie()
,其中用戶ID是 「768」 字符串值。
加密的會話cookie出現在瀏覽器上的下一個請求:
Name=.ASPXAUTH Value=FFC592..... Expires=2016-05-16T15:41:58.817Z (basically "now"+1 hour) Path=/ Domain=localhost HTTP=Yes Secure=(blank i.e. No)
登錄在
Global.asax
Application_BeginRequest()
方法Request.IsAuthenticated
值輸出 「假」(布爾)
我還需要檢查什麼以查看可能會發生什麼錯誤? THanks
謝謝。我可以發誓'Request.IsAuthenticated'在'Begin_Request'處理程序中顯示爲true(一旦登錄),但是根據您提供的證據和我得到的實際效果,我一定是在欺騙自己!謝謝。 –