Saturday, June 21, 2014

Application Level Exception Handling in ASP.NET

This can be done in Global.asax within Application_Error method.

void Application_Error(object sender, EventArgs e)
{
    Exception ex = Server.GetLastError();
 
    if (ex.GetType() == typeof(HttpUnhandledException))
    {
        if (ex.Message.Contains("NoCatch") ||
ex.Message.Contains("maxUrlLength") ||
ex.Message.Contains("File does not exist."))
            return;
           
     
        Response.Write("~/Error.aspx");
    }

    Server.ClearError();
}

Reference: http://msdn.microsoft.com/en-us/library/24395wz3.aspx

Tuesday, June 17, 2014

Difference Between Sql Server VARCHAR and NVARCHAR Data Type


  • varchar : Non-Unicode variable length character type
  • nvarchar : Unicode variable length character type

Note: nvarchar can store both non-Unicode and Unicode characters(Example: Japanese, Korean)