How to filter Exceptions (Such as null parameter) in MVC?
Override your OnException in your controller:
protected override void OnException(ExceptionContext filterContext)
{
if (IsNullParamter(filterContext.Exception))
filterContext.HttpContext.Response.Redirect("~/Home/Index");
base.OnException(filterContext);
}
private bool IsNullParamter(System.Exception ex)
{
string error = ex.Message;
if (error.Contains("System.ArgumentException: The parameters dictionary contains a null entry for parameter")) return true;
if (error.Contains("The parameters dictionary contains a null entry for parameter")) return true;
return false;
}
Microsoft AJAX CDN, JQuery lib
Source
http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js
How to improve the performance of ASP.NET MVC web application
Implementing Caching
Implementing HTTP Compression
Implementing JQuery UI library with Google Hosted Ajax Libraries
By combining scripts and other resources
Deploying production code in release mode
Removing default HTTP modules in ASP.NET
Optimizing URL generation
Using ELMAH with ASP.NET MVC
Insert following part after configSections after third steps
<elmah>
<security allowRemoteAccess="yes" />
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
<errorMail
from="aaa@aaa.aa"
to="aaa@aaa.aa"
subject="ICM Exception …"
async="true"
smtpPort="25"
smtpServer="0.0.0.0"
userName=""
password="" />
</elmah>
Test Credit Card Account Numbers
Visa 4111111111111111
Link
-
Archives
- November 2009 (1)
- October 2009 (4)
- September 2009 (2)
- August 2009 (9)
- July 2009 (10)
- June 2009 (18)
- May 2009 (16)
- April 2009 (29)
- March 2009 (7)
-
Categories
-
RSS
Entries RSS
Comments RSS