Shravan Kumar Kasagoni

Skip Navigation
Understanding ASP.NET Dynamic Compilation

Understanding ASP.NET Dynamic Compilation

 /  Leave a response

When we create a page in ASP.NET, Framework internally creates a .NET class. i.e: An instance of System.Web.UI.Page class.

All the content in ASP.NET page including scripts, HTML content and plain text is compiled into .NET class. When a client request for ASP.NET page then ASP.NET Framework searches for a .NET class corresponding to the page then executes the class. If the class is not found then it compiles the page into new .NET class and stores the class into temporary ASP.NET folder in the following location.

%FrameworkInstallLocation%Temporary ASP.NET Files

If anyone request for same page next time again page is not complied. The corresponding class will be executed. Until unless the page is not compiled again the source code is modified.

This process is called Dynamic Compilation.

When the page is compiled into class then there is a dependency is created between the ASP.NET page and .NET class. If the source code of the page is modified corresponding .NET class will be deleted. If user next time request the page then it will be compiled into a new .NET class. Unlike classical ASP application, the pages are not compiled every time when the user requests.

We have option to precompile an entire ASP.NET application using aspnet_compiler.exe command line tool. If we precompile an application ,user doesn’t experience the compilation delay for first page request.

How to disable dynamic compilation ?

We have attribute CompilationMode, if we use this with <%@Page%> directive we can disable the dynamic compilation for a page. If we use this tag in web.config we can disable for all the pages in a folder or even for entire application.

Write a response

Your email address will not be published. Required fields are marked *

All code will be displayed literally.

Close Bitnami banner
Bitnami