Help Tracking Down an Application Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #16
    Originally posted by tagg3rx
    Hi all
    My project's a web site, not a web project, I do have it on my todo list to upgrade to a web project because it does add some functionality - on the down site of the web projects you have to build em every time you want to see a change made in back end code.

    As for my issue I came in this morning and had 15 more instances of the same error - The references listed in the properties are (as expected) the same ones listed in the Webconfig above - and I use all of them in one form or another so not really wanting to remove any.

    I wish i could figure out what page was throwing the error as part of my error catcher that runs in the the global.asax I have this block:

    Code:
            HttpContext _hContext = HttpContext.Current;
            Exception _ex = _hContext.Server.GetLastError();
    
            StringBuilder _sbError = new StringBuilder();
            try { _sbError.Append("Current User: " + Request.Cookies["uName"].Value + "<br>"); }
            catch { }
            try { _sbError.Append("URL: " + _hContext.Request.Url.ToString() + "<br>"); }
            catch { }
            try { _sbError.Append("Source: " + _ex.Source + "<br>"); }
            catch { }
            try { _sbError.Append("Message: " + _ex.Message + "<br>"); }
            catch { }
            try { _sbError.Append("Details: " + _ex.ToString().Replace("\n", "<br>") + "<br><br><br>"); }
            catch { }
    
            _hContext.Response.Write(_sbError.ToString());
    but on this error i get only the Message and the details.
    Any way to grab the browser history of like the last 4 pages?

    Thanks.
    Daniel
    What Framework are you using?
    3.5?
    There's an Ajax ASP.NET 3.5 Extension for manipulating Browser History...

    I haven't used it myself but I've come across it in my web surfing for a solution to the dreaded browser Back Button.

    -Frinny

    Comment

    • tagg3rx
      New Member
      • Jun 2007
      • 35

      #17
      Hello,
      I Am using 3.5 and i looked at the history control - it looks like it's more for disabling the entry of history items. I just implemented the following i to catch the browsing history just prior to the error thought i'd share for others t use / critique

      in the master page i added the following function called on page load:
      Code:
          protected void BuildLogHistory()
          {
              StringBuilder _sbHistory = new StringBuilder(Request.Cookies["History"].Value as string);
              _sbHistory.Insert(0, Request.Url + "<br>");
      
              if (_sbHistory.Length > 255)
                  Response.Cookies["History"].Value = _sbHistory.ToString(0, 255);
              else
                  Response.Cookies["History"].Value = _sbHistory.ToString();
          }
      then in my error catcher I added a reference to the history cookie, so now when i get the error alert if have the last 2 or 3 pages visited.

      Comment

      Working...