2012-04-02 25 views
0

Ich erhalte die folgende Ausnahme in einem UserControl, Seite laden. Ich habe versucht, dies bei Google zu suchen, habe aber nicht viele Informationen gefunden. Bitte lassen Sie mich wissen, ob mir jemand helfen könnte.System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, boolean includeStagesAfterAsyncPoint)

Die Situation ist, es gibt eine Datei ascx.cs für verschiedene Benutzersteuerungen in verschiedenen Sprachen.

Die Anwendung läuft ordnungsgemäß, aber manchmal wird diese Ausnahme ausgelöst.

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) 

Informationen anfordern: authentifiziert: true Authentifizierungstyp: Formulare Fädeln Sie Kontoname IIS AppPool \ SLC Webseite

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; 
      } 
     } 

Sie finden den BoundAccountsofMember Methodencode zurück.

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; 
      } 
     } 

Die obige Ausnahme wird vom Page_Load -Ereignis ausgelöst. Grüße Srivathya

Antwort

5

Ich könnte vermuten, dass Sie ein Problem mit einer Sitzung hier haben. Sie überprüfen SessionController.CurrentMember != null in Page_Load, aber nicht in Ihrem BoundAccountsOfMember.

Ich glaube, das ist ein Problem hier, wenn Sie sagen, es passiert von Zeit zu Zeit. Sie sollten wahrscheinlich in Ihren Modulen an der Verlängerung/Ungültigkeit der Sitzung arbeiten, um sicherzustellen, dass Ihr Code nicht ohne eine gültige Sitzung ausgeführt wird.