Origional Question:
carlos@g... asks:
I have read some articles about ASP.NET, and they all talk about
"compiled
code" on ASP. As I understand this it will be possible to compile a
standard aspx page so it will run faster.
Is that true or false?
What will be the benefits/disavantages of compiled code in ASP.NET ?
ScottGu Answer:
Hi Carlos,
In ASP, all .asp pages are parsed and then interpretted by a script
engine. In ASP.NET, all .aspx pages are parsed and then compiled and
then executed as native code (using the .NET Runtime) when processing
requests.
This compilation process is done dynamically for you (the first the page
is ever hit) -- so you still get all the benefits of the "just hit save"
development model we have in ASP. For example, I could have the below
Hello.aspx page:
<html>
<body>
<%
Dim i as Integer
For i=3D0 to 7
%>
<font size=3D"<%=3Di%>"> Hello Carlos </font>
<%
next
%>
</body>
</html>
The above page looks like a standard .asp page -- but when saved in a
"Hello.aspx" file and hit by a browser -- it will by compiled by VB and
executed as native code. If I make any modifications to the file (and
hit save again) we will dynamicaly recompile it for you.
The biggest benefit to compilation is speed. Compiled code can be much,
much faster than interpretted script code -- so your pages will run
faster and your customers will get better results when they visit your
web application.
A side benefit of compilation is that it provides you with much richer
language options when programming pages. Instead of just being limited
to late bound script engines -- you can now literally program in any
language that you want (compiled or interpretted ones).
ASP.NET out of the box now supports three languages: VB, JScript and C#.
Other 3rd parties will be adding support for many, many more.
Hope this helps,
Scott