Breaking News

Code Compilation

Code Compilation

You will deploy the uncompiled source file whenever you deploy an application created by Visual Studio. When the first time a page is requested, it is compiled dynamically and cached in a temporary directory for reuse.

The Advantage of this approach is that it is easy to make changes directly to your files without needing to go through any compilation steps.

Disadvantages of this approach are:

The first request for a page is slow. After a page has been requested more than once then this problem disappears.
The web server contains all your source code and is clearly visible to anyone who has access to the server. Website Administrator can view a code but a visitor cannot.

To improve performance and prevent other people from seeing your code, you can use an ASP.NET recompilation feature. Essentially, you use a command –line tool named aspnet_compiler.exe, which is stored in the familiar c: drive directory. You can use this compiler on your development machine before you deploy the application. It compiles the entire website into binary files.

Here is the syntax for the asp.net_compiler tool:

Aspnet_compiler –m metabasePath targetDirector

Essentially, you need to specify the source where the web application resides and the target directory where the compiled version of the application should be copied.

Aspnet_compiler –m W3SVC/1/ROOT/MyApp C:\MyAppDeploy

You can then copy the files from the target directory to your web server and if you use the command line, then C:\MyAppDeploy Directory will contain all the .aspx files but no .cs files it means all the source code is compiled into assemblies in the Bin directory and hidden. The information in the .aspx files also has been removed. When you open a web page you will find that it does not contain any tags. All the tags have been moved into the compiled files in the Bin directory, along with the source code.

Check Also

Calendar Server Control

Calendar Server Control The Calendar server control is a rich control that allows you to …