Click here to Skip to main content
15,860,861 members
Articles / Web Development / ASP.NET

MVC Basic Site: Step 2 - Exceptions Management

Rate me:
Please Sign up or sign in to vote.
4.90/5 (46 votes)
25 Oct 2013Ms-PL16 min read 144.8K   5.4K   135  
This second article from the "MVC Basic Site" series presents in details the exceptions management rules and their implementation for an ASP.NET MVC web site, and provides some utile base classes and source code for Logging and Exceptions Management that can be reused.
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="AboutTitle" xml:space="preserve">
    <value>Despre</value>
  </data>
  <data name="AddressCountry" xml:space="preserve">
    <value>Țara</value>
  </data>
  <data name="AddressFax" xml:space="preserve">
    <value>Fax</value>
  </data>
  <data name="AddressFirstName" xml:space="preserve">
    <value>Prenume</value>
  </data>
  <data name="AddressLastName" xml:space="preserve">
    <value>Nume</value>
  </data>
  <data name="AddressPhone" xml:space="preserve">
    <value>Telefon</value>
  </data>
  <data name="AddressStreet" xml:space="preserve">
    <value>Strada</value>
  </data>
  <data name="AddressTown" xml:space="preserve">
    <value>Localitatea</value>
  </data>
  <data name="AddressZipCode" xml:space="preserve">
    <value>Cod poștal</value>
  </data>
  <data name="Cancel" xml:space="preserve">
    <value>Renunță</value>
  </data>
  <data name="ErrorLoadingData" xml:space="preserve">
    <value>Eroare la încărcarea datelor de pe Server!</value>
  </data>
  <data name="ErrorPageMessage" xml:space="preserve">
    <value>Ne pare rău, a apărut o eroare la procesarea solicitării dvs.</value>
  </data>
  <data name="HeaderPartialLogoff" xml:space="preserve">
    <value>Ieșire</value>
  </data>
  <data name="HeaderPartialLogon" xml:space="preserve">
    <value>Autentificare</value>
  </data>
  <data name="HeaderPartialWelcome" xml:space="preserve">
    <value>Bun venit</value>
  </data>
  <data name="IndexTestExpectedException" xml:space="preserve">
    <value>Testați Excepție Așteptată</value>
  </data>
  <data name="IndexTestUnhandledException" xml:space="preserve">
    <value>Testați Excepție Netratată</value>
  </data>
  <data name="IndexTitle" xml:space="preserve">
    <value>Bine ați venit!</value>
  </data>
  <data name="LogOnErrorMessage" xml:space="preserve">
    <value>Numele de utlizator sau parola incorecta</value>
  </data>
  <data name="LogOnLegend" xml:space="preserve">
    <value>Informațiile Contului</value>
  </data>
  <data name="LogOnLoginButton" xml:space="preserve">
    <value>Autentificare</value>
  </data>
  <data name="LogOnMessage" xml:space="preserve">
    <value>Introduceți vă rog numele de utilizator și parola, sau </value>
  </data>
  <data name="LogOnMessage2" xml:space="preserve">
    <value>dacă nu aveți deja unul.</value>
  </data>
  <data name="LogOnModelPassword" xml:space="preserve">
    <value>Parola</value>
  </data>
  <data name="LogOnModelUsername" xml:space="preserve">
    <value>Nume utilizator</value>
  </data>
  <data name="LogOnRegisterLink" xml:space="preserve">
    <value>creați-vă un cont</value>
  </data>
  <data name="LogOnTitle" xml:space="preserve">
    <value>Autentificare</value>
  </data>
  <data name="LogOnValidationSummary" xml:space="preserve">
    <value>Erori la autentificare. Corectați vă rog erorile și reâncercați!</value>
  </data>
  <data name="MenuAbout" xml:space="preserve">
    <value>Despre</value>
  </data>
  <data name="MenuHome" xml:space="preserve">
    <value>Acasă</value>
  </data>
  <data name="MenuMyAccount" xml:space="preserve">
    <value>Contul Meu</value>
  </data>
  <data name="MyAccountTitle" xml:space="preserve">
    <value>Contul Meu</value>
  </data>
  <data name="RegisterBack" xml:space="preserve">
    <value>Înapoi</value>
  </data>
  <data name="RegisterInvalidUsername" xml:space="preserve">
    <value>Nume utilizator invalid! Există deja un utilizator cu acest nume!</value>
  </data>
  <data name="RegisterRegister" xml:space="preserve">
    <value>Crează cont</value>
  </data>
  <data name="RegisterThanks" xml:space="preserve">
    <value>Mulțumesc pentru crearea contului!</value>
  </data>
  <data name="RegisterTitle" xml:space="preserve">
    <value>Creare cont</value>
  </data>
  <data name="UserAndAddressComfirmEmail" xml:space="preserve">
    <value>Comfirmă email</value>
  </data>
  <data name="UserAndAddressComfirmPassword" xml:space="preserve">
    <value>Comfirmă parola</value>
  </data>
  <data name="UserAndAddressEmail" xml:space="preserve">
    <value>Email</value>
  </data>
  <data name="UserAndAddressPassword" xml:space="preserve">
    <value>Parola</value>
  </data>
  <data name="UserAndAddressUsername" xml:space="preserve">
    <value>Nume utilizator</value>
  </data>
  <data name="ValidationRequired" xml:space="preserve">
    <value>Obligatoriu</value>
  </data>
</root>

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 Microsoft Public License (Ms-PL)


Written By
Romania Romania
I have about 20 years experiences in leading software projects and teams and about 25 years of working experience in software development (SW Developer, SW Lead, SW Architect, SW PM, SW Manager/Group Leader).

Comments and Discussions