Buscar contenidos

lunes, 22 de enero de 2018

Error + GlobalAsax + Application_Error



  protected void Application_Error(object sender, EventArgs e)
        {   

string HtmlErrorHandling = @"
            <html>
               <head>
                  <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
                  <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'></script>
                  <link rel='stylesheet' type='text/css' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>
                  <script type='text/javascript'>
                     $(function() {
        
                     $('#DetalleContent').hide();
                 
                     $('#VerDetalle').click(function() {
        
                     $('#DetalleContent').slideToggle();
        
                     });
        
                     });
        
                  </script>
               </head>
               <body style='font-family: Helvetica, Arial, sans-serif; font-size: 14px;'>
                  <div class='row'>
                     <div class='col-sm-3'>&nbsp;</div>
                     <div class='col-sm-6'>
                        <img alt='' class='img-responsive' src='/Images/ErrorImage.png' />
                     </div>
                     <div class='col-sm-3'>&nbsp;</div>
                  </div>
                  <hr style='border:10px solid #D8D8D8;'/>
                  <div class='row'>
                     <div class='col-sm-12' style='font-size:15px; cursor: pointer; color:#BE2021; text-align: center;' ><a href='[uri]'>Clic aquí para reintentar ingresar</a></div><hr/>
                     <div id='VerDetalle' class='col-sm-12' style='font-size:13px; cursor: pointer; color:#BE2021; text-align: center;' >Clic aquí para ver detalle técnico</div>
                     <div id='DetalleContent' class='col-sm-12' style='font-size:12px; color:#B2A9A7; text-align: center;' >[error]</div>
                  </div>
               </body>
            </html>
            ";
         
            string ErrorContent = "<b>Message:</b><br/>" + CurrentError.Message + "<br/>" + "<b>StackTrace:</b><br/>" + CurrentError.StackTrace + "<br/>" + "<b>InnerException:</b><br>" + CurrentError.InnerException + "<br/>" + "<b>Source:</b><br/>" + CurrentError.Source;

            HtmlErrorHandling = HtmlErrorHandling.Replace("[error]", ErrorContent).Replace("[uri]", Request.Url.AbsoluteUri);

            HttpContext.Current.Response.ContentType = "text/html";
            Response.Write(HtmlErrorHandling);

            Server.ClearError();