August 11, 2002 - Compiling Hello World's Code Behind Version | WebReference

August 11, 2002 - Compiling Hello World's Code Behind Version

Yehuda Shiran August 11, 2002
Compiling Hello World's Code Behind Version
Tips: August 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

One of the advantages of Code Behind is that the .NET framework compiles it automatically, when it detects a need for it. This need arises when the source code is fresher than the corresponding binary file. Sometimes, though, you need to know how to compile your Code Behind code by yourself. It will give you a great insight into how the .NET framework works. Once you have your code written, the next step is to compile it into a dll file in the bin directory underneath the working directory where you keep your code. When the Web server displays an ASP.NET page (.aspx), it searches all dll files in the bin directory for the namespaces that the ASP.NET page requires. When compiling the JScript .NET page (for example helloworld.aspx.js), you need to instruct the compiler to put the dll file in the bin directory:

  jsc /t:library /out:bin\codebehind.dll helloworld.aspx.js
The name of the dll file is not that important, because the Web server searches all dll files for the required namespace. The following Command Prompt window shows the code listing and the compilation stage:

To learn more about JScript .NET and ASP.NET, go to Column 115, JScript .NET, Part IX: Code Behind.