Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Handling Error Centrally in a SharePoint Application

, 20 May 2008 CPOL
An article on handling errors centrally in a SharePoint application, using IHttpModule.
handlingerrorcentrallyinsharepointapplication.zip
HandlingErrorCentrallyinSharePointApplication
CentralErrorHandler
CentralErrorHandler
bin
Debug
CentralErrorHandler.snk
obj
Debug
Refactor
TempPE
Properties
handlingerrorscentrallyinspapp.zip
CentralErrorHandler.snk
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyErrorHandler.aspx.cs" Inherits="MyErrorHandler" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Error Page</title>
    <style type="text/css"><!--
    *{
    font-family:Verdana;font-size:14px;
    }
.div_getinfo
{
  clear:both;
  margin-top:4px;  
  margin-bottom:4px;  

}
.div_getinfo span
{  
  padding-right:10px; 
  vertical-align:top;
  
  /*
  margine-right:10ppx;

    
     padding-left:100px; 
    width:198px
      */
}
.save{
   behavior:url(#default#savehistory);}
a.dsphead{
   text-decoration:none;
   margin-left:2px;
   font-size:14px;
   
   ;}
a.dsphead:hover{
   text-decoration:underline;}
a.dsphead span.dspchar{
   font-family:monospace;
   font-weight:normal;}
.dspcont{
   display:none;
   margin-left:20px;}
//--></style>

    <script type="text/javascript"><!--
function dsp(loc){
   if(document.getElementById){
      var foc=loc.firstChild;
      foc=loc.firstChild.innerHTML?
         loc.firstChild:
         loc.firstChild.nextSibling;
      foc.innerHTML=foc.innerHTML=='+'?'-':'+';
      foc=loc.parentNode.nextSibling.style?
         loc.parentNode.nextSibling:
         loc.parentNode.nextSibling.nextSibling;
      foc.style.display=foc.style.display=='block'?'none':'block';}}  

if(!document.getElementById)
   document.write('<style type="text/css"><!--\n'+
      '.dspcont{display:block;}\n'+
      '//--></style>');
//--></script>

</head>
<body style="text-align: center;">
    <form id="form1" runat="server">
        <div style="width: 800px; text-align: left; margin-top: 30px">
            <asp:Label ID="Label1" runat="server" Width="140px">Title:</asp:Label>
            <asp:Label ID="Label2" runat="server">An unexpected error has occurred.</asp:Label><br />
            <asp:Label ID="Label5" runat="server" Width="140px">Error Code:</asp:Label>
            <asp:Label ID="uxErrorCode" runat="server"></asp:Label><br />
            <asp:Label ID="Label3" runat="server" Width="140px">Description:</asp:Label>
            <asp:Label ID="uxErrorMessage" runat="server"></asp:Label><br />
            <div class="save">
                <h1>
                    <a href="javascript:void(0)" class="dsphead" onclick="dsp(this)"><span class="dspchar">
                        +</span>StackTrace</a></h1>
                <div class="dspcont">
                    <asp:Label ID="uxStackTrace" runat="server">No information available!</asp:Label></div>
            </div>
            <div class="div_getinfo" style="margin-top: 20px">
                <div style="display: inline; float: left">
                    <asp:Label ID="Label7" runat="server" Width="140px">ActionDescription:</asp:Label>
                </div>
                <div style="display: inline; float: left">
                    <asp:Label ID="Label8" runat="server">Please contact support@Anupam Ranku<br /> supply the Error-Code.</asp:Label>
                </div>
            </div>
            <div style="clear: both; display: block; margin-top: 20px;">
                <a href="JavaScript:void(0);" onclick="javascript:history.back();">Go back to site</a>
            </div>
        </div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Anupam Ranku
Software Developer (Senior) Gen-i, Australia
Australia Australia
Expertise area: ASP.NET, C#, Microsoft Office SharePoint 2010 & 2007, Web Service, Windows-based Applications etc.
 
Blog: http://mydevdiary.blogspot.com/

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411022.1 | Last Updated 20 May 2008
Article Copyright 2008 by Anupam Ranku
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid