Today I have released a project WebLogViewer alpha version on CodePlex.

The url is. It uses LogParser 2.2 SDK and JQuery. It can be installed on any remote machine running IIS and event log can be viewed using any standard HTML browser.

The following will help in loading a web page faster.

  • Always add javascript code at the end of a web page.

Add javascript code between end tags of the body and html tags. Browser loads DOM objects first and javascript code later. This will avoid blank browser loading page and user can see HTML objects in the browser very quickly.

  • Always set cache-expire in the response header.
  • Avoid viewstate for simple pages(by default view state enabled) or in pages where viewstate not needed.
  • Use gzip(or deflate) compression.

Compression can decrease the number of bytes by your server. This will help in loading pages faster and cuts down on bandwidth usage. But beware it might affect CPU performance as extra processing required to compress/uncompress. Major browsers currently supporting gzip and deflate compressions. GZIP compression is built into IIS6.0.

  • Avoid using HTML table(s). It was proven that browser takes more time to load a table.
  • Use gif files instead of JPG files
  • Avoid dataset walking for DB related logic instead use stored procedures.

For example, filters, sorting, searching etc.

  • Avoid Bind and Eval methods instead use code behind logic to load data.
  • Avoid too many postbacks, Use update panels(Asynchronous postback) or Ajax calls to refresh/update data.
  • Always follow guidelines to avoid javascript memory leaks.

Recently I constantly encountered ‘Failed to Enable constraints…’ error when working with DataTables. .Net doesn’t provide any detailed information for this error.
This error might be due to
a) Query columns and Fill method columns mismatch
b) Column maxlength exceeded
c) Duplicate rows(when some join)
d) some other when loading data into the DataTable.
I have had used step through debug to know what caused this error and it was time consuming. But .Net provides a workaround solution for this in the form of DataTable GetErrors method. To know what exactly causing this error(column data), I have used below method to get all the DataTable errors that saved my debugging time.


        public string GetErrors(DataTable table)
            StringBuilder s = new StringBuilder();
             // Test if the table has errors. If not, skip it.
            if (table.HasErrors)
              // Print the error of each column in each row.
               foreach (DataRow row in table.GetErrors())
                  foreach (DataColumn column in table.Columns)
                      s.Append(column.ColumnName + "-" + row.GetColumnError(column));
                   // Clear the row errors

            return s.ToString();


Happy Debugging….

“Reference” comment in the JS file allows you to see JScript functions and objects from any external file whether it could be an another JS file or a web page or a web service or even an embedded resource.

The common usage is


///<reference path=”path of webservice or jsfile or webpage” />




///<reference name=”resource-name” assembly=”assembly-name” />



To reference Ajax library


/// <reference name="MicrosoftAjax.js"/>



Happy coding…

Welcome to my technical blog. Today I upgraded this site to BlogEngine.Net 1.4.5 with SQL Server as DB provider. What I noticed was BlogEngine.Net with roles will only run in medium trust or higher. I’m running this site on a shared hosting account, and custom overrides of trust configuration were not allowed. 

Initially I tried with SQLite DB(thought it would be more faster ). My hosting provider doesn’t allow to change default directory permissions. At last I switched to SQL server, site was running up with in few minutes.