How to setup Elmah.MVC with ASP.NET MVC 4 ?

What is Elmah ? ELMAH is an open source project whose purpose is to log and report unhandled exceptions in ASP.NET web applications.

Why to use Elmah ? ELMAH serves as an unobtrusive interceptor of unhandled ASP.NET exceptions, those usually manifesting with the ASP.NET yellow screen of death.

So now we know what and why to use Elmah, Lets quickly get started on how to use Elmah with your ASP.NET MVC project.

Step 1: Right click on your solution and select the “Manage Nuget Packages” option Elmah - Step 1 - Manage Nuget Packages

Step 2: In the Nuget Package manager search for “Elmah” and install the Elmah.MVC nuget extension.Step 2 - Elmah - Elmah mvc nuget search The Nuget Package manager will download and add the required dlls and modify the web.config’s <appSetting> for Elmah to work. Step 2 - Elmah - Elmah mvc nuget web config

Step 3: That’s it !! Your Elmah is now ready to test. I have generated a 404 to test if my Elmah works, ELMAH can be accessed by this url : Elmah - Output Screen 0Elmah - Output Screen 1

Hope this helps :)

Further Reading :

An introduction to accounting.js, a javascript library for number, money and currency formatting

accounting.js is a tiny JavaScript library for number, money and currency formatting, with optional excel-style column rendering (to line up symbols and decimals). It’s lightweight, fully localisable and has zero dependencies. This JavaScript library can be downloaded from here

Why to use accounting.js ?
* Its open source
* Lightweight : Latest version from Github (3kb, minified)
* Fully localisable and has zero dependencies.

Where to use accounting.js ?
Can be used in finance and accounting, reporting apps for adding client-side number formatting.

Key features of accounting.js:
* Control decimal place
* Rounding for floating point numbers
* Excel-style column rendering (to line up symbols and decimals)
* Money formatting Below are few examples from the docs :

.formatMoney() :

// Default usage: 
accounting.formatMoney(12345678); // $12,345,678.00

// European formatting (custom symbol and separators), could also use options object as second param:
accounting.formatMoney(4999.99, "€", 2, ".", ","); // €4.999,99

// Negative values are formatted nicely, too:
accounting.formatMoney(-500000, "£ ", 0); // £ -500,000

.formatNumber() :

accounting.formatNumber(5318008); // 5,318,008
accounting.formatNumber(9876543.21, 3, " "); // 9 876 543.210

.toFixed() :

(0.615).toFixed(2); // "0.61"
accounting.toFixed(0.615, 2); // "0.62"

Hope this helps :)

Further Reading :
* Currency conversion and money formating libraries in Javascript
* Github – accounting.js

How to set SmtpClient properties using web.config

SmtpClient Class allows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP). Instead of assigning properties of this class in C# , we can use the <> element in the web.config as shown below :

        <smtp from = "">
                host = ""
                port = "25"
                password = "password"
                userName = ""
                defaultCredentials = "false"
                enableSsl = "true"

The advantage of this approach is that we can change the mail settings without having to rebuild the entire application.

Hope this helps :)

Further Reading :
Sending Email with System.Net.Mail