Friday, October 26, 2012

How to speed up ASP.net page load after compilations.



First thing I did to reduce the compile time is to set my "batch" flag to false 
As per MSDN

the batch flag "eliminates the delay caused by the compilation required when you access a file for the first time. When this attribute is set to True, ASP.NET precompiles all the uncompiled files in a batch mode, which causes an even longer delay the first time the files are compiled. However, after this initial delay, the compilation delay is eliminated on subsequent access of the file."


Secondly I set "optmizeCompilation" flag to true, which was introduced with .net 3.5_sp1. By setting this flags I reduced my ASP.net load time after compilation from 2 minutes to 7 seconds on average.

for further info please read below MSDN link special advantage/disadvnatage of Dynamic compilation part. 

http://msdn.microsoft.com/en-us/library/ms366723%28v=vs.100%29.aspxhttp://msdn.microsoft.com/en-us/library/ms366723%28v=vs.100%29.aspx

Below is what my looks like in Web.config file.

<compilation defaultLanguage="C#" debug="true" batch="false" optimizeCompilations="true" />

Javascript Framworks

http://jster.net/category/mobile-frameworks#.UImwrdeDYnK

ThreadAbortException Occurs If You Use Response.End, Response.Redirect, or Server.Transfer

 

http://support.microsoft.com/kb/312629

the reason this happens, is because

The Response.End method ends the page execution and shifts the execution to the Application_EndRequest event in the application's event pipeline. The line of code that follows Response.End is not executed.
This problem occurs in the Response.Redirect and Server.Transfer methods because both methods call Response.End internally.

 

To work around this problem, use one of the following methods:

  • For Response.End, call the HttpContext.Current.ApplicationInstance.CompleteRequest method instead of Response.End to bypass the code execution to the Application_EndRequest event.
  • For Response.Redirect, use an overload, Response.Redirect(String url, bool endResponse) that passes false for the endResponse parameter to suppress the internal call to Response.End. For example:

      Response.Redirect ("nextpage.aspx", false);
    						

    If you use this workaround, the code that follows Response.Redirect is executed.

  • For Server.Transfer, use the Server.Execute method instead.