2012-04-02 26 views
0

UserControl、Page Loadで以下の例外が発生しています。私はGoogleでこれを検索しようとしましたが、多くの情報が見つかりませんでした。もし誰かが私を助けてくれたら教えてください。System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint、Boolean includeStagesAfterAsyncPoint)

状況によっては、さまざまな言語のさまざまなユーザーコントロール用に1つのascx.csファイルがあります。

アプリケーションは正常に動作していますが、この例外は時々投げられることがあります。

Exception information: 
Exception type: NullReferenceException 
Exception message: Object reference not set to an instance of an object. 
at SmartSoft.SmartLiveWeb.UserControls.Common.PayoutForms.BoundAccountsOfMember() 
at SmartSoft.SmartLiveWeb.UserControls.Common.PayoutForms.Page_Load(Object sender, EventArgs e) 
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) 
at System.Web.UI.Control.LoadRecursive() 
at System.Web.UI.Control.LoadRecursive() 
at System.Web.UI.Control.LoadRecursive() 
at System.Web.UI.Control.LoadRecursive() 
at System.Web.UI.Control.LoadRecursive() 
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

リクエスト情報: が認証される:真 認証タイプ:フォーム スレッドアカウント名:IIS APPPOOL \ SLCウェブサイト

protected void Page_Load(object sender, EventArgs e) 
     { 
      if (!Page.IsPostBack) 
      { 
       /* 
       if (Request.QueryString.Count > 0 && Request.QueryString["MId"] != null) 
        this.MId = int.Parse(Request.QueryString.Get("MId")); 
       */ 

       HideAllForms(); 
       AddValidationAttributesToControls(); 
       **BoundAccountsOfMember();** 
       BoundWithdrawMethods(); 
       /* 
       * if (IsNetentConfirmationRequired()) 
        LoadNetentConfirmationForm(); 
       * 
       */ 
       CurrentPayoutMethod = (PayoutMethodEnum)Convert.ToInt16(SessionController.GetSessionData<object>("PayoutMethod")); 
      } 

      PlaceHolder phWithdraw = this.FindControl("phWithdraw") as PlaceHolder; 
      Panel pnlKYC = this.FindControl("pnlKYC") as Panel; 

      if (SessionController.CurrentMember != null && SessionController.CurrentMember.Approved == 10) 
      { 
       phWithdraw.Visible = false; 
       pnlKYC.Visible = true; 
      } 
      else 
      { 
       phWithdraw.Visible = true; 
       pnlKYC.Visible = false; 
      } 
     } 

は背後BoundAccountsofMemberメソッドのコードを見つけてください。

private void BoundAccountsOfMember() 
     { 
      Dictionary<Int16, AccountType> accountTypes = SessionController.CurrentMember.GetAccountTypes(); 

      ddlWithdrawFrom.Items.Clear(); 
      foreach (AccountType accountType in accountTypes.Values) 
      { 
       ddlWithdrawFrom.Items.Add(new ListItem(accountType.AccountName, accountType.AccountId.ToString())); 
      } 
      ListItem li = ddlWithdrawFrom.Items.FindByValue(SessionController.DefaultAccountId.ToString()); 
      if (li != null) 
      { 
       ddlWithdrawFrom.SelectedIndex = -1; 
       li.Selected = true; 
      } 
     } 

上記の例外はPage_Loadイベントからスローされています。 よろしくお願いいたします。 Srividhya

答えて

5

ここでセッションに問題があると推測できます。あなたはPage_LoadSessionController.CurrentMember != nullをチェックしていますが、BoundAccountsOfMemberにはありません。

時間がかかると言っているのなら、それはここで問題になると思います。モジュールでセッションの更新/無効化を行い、コードが有効なセッションなしで実行されないようにする必要があります。

関連する問題