簡體   English   中英

會話丟失后的Membership SettingsPropertyNotFoundException

[英]Membership SettingsPropertyNotFoundException after session was lost

我正在使用成員身份,並創建了一個包含名為FirstName的屬性的自定義配置文件。 除非會話/ Cookie丟失,否則它會很好地工作(由於很難復制,因此我沒有弄清楚是哪一個)。 然后,當我訪問網站的任何頁面時,都會出現此異常:

[SettingsPropertyNotFoundException:找不到設置屬性'FirstName'。] System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)+8757578 System.Configuration.SettingsBase.get_Item(String propertyName)+118 System.Web.Profile.ProfileBase.GetInternal(字符串propertyName)+49 System.Web.Profile.ProfileBase.get_Item(字符串propertyName)+129 WebFrontend.Security.SecurityHandler.get_FullName()+168 WebFrontend.Controls.LoginInfo.SetupLoginStatus()+15 System.Web.UI.Control。 InitRecursive(控件命名容器)+186 System.Web.UI.Control.InitRecursive(控件命名容器)+421 System.Web.UI.Control.InitRecursive(控件命名容器)+421 System.Web.UI.Control.InitRecursive(控件命名容器) +421 System.Web.UI.Control.InitRecursive(控件命名容器)+421 System.Web.UI.Page.ProcessRequestMain(布爾值includeStagesBeforeAsyncPoint,布爾值includeStagesAfterAsyncPoint)+2098

您是否知道如何阻止該異常被拋出? 此網站的CustomErrors均為ON,它繞過錯誤頁面,而是顯示異常。 我只是想防止用戶看到這個丑陋的異常。

聽起來好像您在嘗試不再對用戶配置文件進行身份驗證時嘗試訪問它們。 我建議您考慮在訪問用戶配置文件屬性之前實現登錄視圖或檢查身份驗證:

  1. 登錄視圖: http : //msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.loginview.anonymoustemplate(v=vs.100).aspx

  2. 檢查身份驗證: http : //msdn.microsoft.com/zh-cn/library/system.web.httprequest.isauthenticated(v=vs.90).aspx

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM