Debugging Dotnet Web Application

Discussion in 'ASP .Net Web Services' started by jpaquette@comloginc.com, Apr 28, 2005.

  1. Guest

    Anyone who could help with this I would greatly appreciate it. I'm
    managing a dotnet website that has several persistent errors in it I'm
    trying to fix. The problem is that the error trapping I have set up
    does not provide me with enough useful information to find the problem
    and correct it. Here is the procedure I have set up to handle errors:

    protected void Application_Error(Object sender, EventArgs e){
    string strError = "Error in: " + Request.Path +
    "\nUrl: " + Request.RawUrl + "\n\n";

    // Get the exception object for the last error message that
    occured.
    Exception ErrorInfo = Server.GetLastError();
    strError += "Error Message: " + ErrorInfo.InnerException.Message+
    "\n" + ErrorInfo.TargetSite +
    "\nError Source: " + ErrorInfo.Source + "\nError Target Site: " +
    ErrorInfo.TargetSite + "\n\nQueryString Data:\n-----------------\n";

    // Gathering QueryString information
    for (int i = 0; i < Context.Request.QueryString.Count; i++)
    strError += Context.Request.QueryString.Keys + ":\t\t" +
    Context.Request.QueryString + "\n";
    strError += "\nPost Data:\n----------\n";

    // Gathering Post Data information
    for (int i = 0; i < Context.Request.Form.Count; i++)
    strError += Context.Request.Form.Keys + ":\t\t" +
    Context.Request.Form + "\n";
    strError += "\n";
    if (User.Identity.IsAuthenticated) strError += "User:\t\t" +
    User.Identity.Name + "\n\n";
    strError += "Exception Stack Trace:\n----------------------\n" +
    Server.GetLastError().StackTrace + "\n";
    StackTrace st=new StackTrace (Server.GetLastError(),true);
    StackFrame sf=st.GetFrame(0);
    strError += "\nLine Number:"+sf.GetFileLineNumber()+"\n";
    strError += "\n\nServer Variables:\n-----------------\n";

    // Gathering Server Variables information
    bool SendMail=true;
    for (int i = 0; i < Context.Request.ServerVariables.Count; i++)
    {
    strError += Context.Request.ServerVariables.Keys + ":\t\t" +
    Context.Request.ServerVariables + "\n";
    if(Context.Request.ServerVariables=="216.143.157.32")
    SendMail=false;
    }
    strError += "\n
    }
    }
    }
    }
    The information generated by this procedure is then emailed to me.
    When I get the email this is what I find:

    Error in: /Default.aspx
    Url: /Default.aspx

    Error Message: Object reference not set to an instance of an object.
    Boolean HandleError(System.Exception)
    Error Source: System.Web
    Error Target Site: Boolean HandleError(System.Exception)

    QueryString Data:
    -----------------

    Post Data:
    ----------

    Exception Stack Trace:
    ----------------------
    at System.Web.UI.Page.HandleError(Exception e)
    at System.Web.UI.Page.ProcessRequestMain()
    at System.Web.UI.Page.ProcessRequest()
    at System.Web.UI.Page.ProcessRequest(HttpContext context)
    at
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    Boolean& completedSynchronously)

    When I look at the stack trace to find the problem it looks as though
    it's giving me information about the script I wrote to handle the
    error, not the actual code that broke. At this point I'm not sure if I
    have my error handling set up to give me the proper information. If
    anyone has any ideas at all about what I can do, please let me know.
    Thanks in advance.
    , Apr 28, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    1
    Views:
    1,324
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    530
    SpamProof
    Oct 21, 2003
  3. Chuck
    Replies:
    3
    Views:
    492
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 8, 2007
  4. J. Paquette

    Debugging Dotnet Web Application

    J. Paquette, Sep 1, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    105
    J. Paquette
    Sep 1, 2004
  5. Debugging Dotnet Web Application

    , Jan 10, 2005, in forum: ASP .Net Web Services
    Replies:
    8
    Views:
    158
Loading...

Share This Page