0

我有时会在实时应用程序中遇到错误。

堆栈跟踪:

在 Tool.User_RequestSender.Page_Load(Object sender, EventArgs e) in d:\Site\Tool\User\RequestSender.aspx.cs:line 72 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t , EventArgs e) 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) 在 System.Web.UI.Control.OnLoad(EventArgs e) 在 System.Web.UI.Control.LoadRecursive() 在 System. Web.UI.Page.ProcessRequestMain(布尔型 includeStagesBeforeAsyncPoint,布尔型 includeStagesAfterAsyncPoint)

我一次又一次地尝试在我的机器上运行代码,但无法得到同样的错误。

即使我生活在代码中,我也会偶尔遇到这个问题。

RequestSender.aspx.cs 中的 Page_Load 代码:

protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                this.LoadRequest();
            }
        }
        catch (CustomException ex)
        {
            this.ShowMessage(ex.Message);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

LoadRequest() 如下:

private void LoadRequest()
    {
        Credential credential;


            if (
                !string.IsNullOrEmpty(Request["typeOfrequest"]) &&
                !string.IsNullOrEmpty(Request["empUserId"]) &&
                !string.IsNullOrEmpty(Request["applicationId"])
               )
            {
                // Get details of credentials
                credential = (new RequestManager()).GetCredential(this.EmpUserId, this.ApplicationId, (int)this.TypeOfrequest);
                this.applicaionRequest = new Request
                {
                    RequestType = this.TypeOfrequest,
                    RequestStatus = Enumerations.RequestStatus.Sent,
                    Application = credential.Application,

                    EmpUserId = credential.EmpUserId,
                    EmployeeId = credential.EmployeeId,
                    Username = credential.Username,

                    SenderAddress = Security.CurrentUser.Details.EmailAddress,
                    ReceiverAddress = (new Datastore.RequestStore()).GetReceiverAddress((int)this.TypeOfrequest, this.ApplicationId),
                    AddedBy = Security.CurrentUser.Details.UserId
                };
                    ucSendRequest.ApplicationRequest = applicaionRequest;

            }
            else
            {
                Response.Write("Invalid request!");
                Response.End();
            }
        }

    }
4

1 回答 1

0

错误清楚地表明 smthnull在应用程序执行期间。

要获得任何帮助,您应该检查null值(RequestinLoadRequest()可能是一个很好的候选者),或者更好的解决方案,修改您的 catch 博客以记录导致应用程序崩溃的参数。

于 2013-02-25T10:25:13.310 回答