When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles
Related Web Technologies
User Tips!
Coding Tips

Sample Chapters
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Stump the SQL Guru!
XML Info
Author an Article
Print this page.
Published: Monday, July 17, 2000

Creating ASP.NET Pages with your Favorite Language

When creating ASP pages, developers commonly use VBScript, a Microsoft-created scripting language that closely resembles the VisualBasic syntax. Of course ASP pages can be created using any scripting language that has a ActiveX Scripting Engine... such langugages include: VBScript, JScript, PerlScript, and Python. (To learn more about creating ASP pages with JScript be sure to visit our JScript Article Index. To learn more about PerlScript be sure to read: Using PerlScript to Create ASP Pages.)

- continued -

Scripting languages have two disadvantages over compilable languages (like Visual C++ or VisualBasic). First is performance; each time an ASP page is visited, these scripts are interpretted by the appropriate scripting engine and a version of their execution plan was cached to increase performance. This cache, though, is an in-memory cache, so at any time only a small number of "interpretted" ASP pages can actually be cached. The second disadvantage is that scripting languages are often designed for accomplishing quick, procedural tasks. Therefore they oftentimes lack the full feature set that compilable languages contain.

One of my favorite things about ASP.NET is that they are created without the use of a scripting language; rather, ASP.NET pages are generated with comilable languages! In fact, ASP.NET pages can be created with any compiler that generates NET Common Language Runtime-compliant code. NET Common Language Runtime-compliant compilers include the Visual Studio 7 suite: VisualBasic 7.0, Visual C++ 7.0, and C# (pronounced C-sharp). When an ASP.NET page is requested for the first time, it is compiled and the resulting NET Common Language Runtime bytecode is saved to disk. This bytecode is then loaded each subsequent request to that ASP.NET page! Since the bytecode exists on disk, an ASP.NET page only needs to be recompiled when the developer alters the page's source.

Creating ASP.NET Pages with VisualBasic 7
So, no longer will you be able to use VBScript... rather you'll be using good ol' VisualBasic 7! This has several advantages. Recall that ASP is currently a Variant-based system, there are no hard and fast data types, everything is a Variant. For example, in an ASP page you might see code like:

Dim strMyFirstName

While you may use strMyFirstName to store a string, behind the scenes strMyFirstName is represented as a Variant, able to be a string, an integer, a floating point number, or even an object. With ASP.NET, using VisualBasic 7, you can now type your variables like so:

Dim strMyFirstName as String

This has three advantages: first, it removes the ambiguity of the purpose of a variable; second, it helps the developer catch a mistake... for example, if you attempt to assign an object to the string variable you will get an error; third, there is a performance increase since the compiler can treat the variable as a string, and not have to worry about what type the variable be or become.

VisualBasic 7 also includes many new enhancements regarding Object-Oriented Programming. VisualBasic's enhancements in this area include: Inheritence, Encapsulation, Overloading, Polymorphism, and (my favorite) Parameterized Constructors. Furthermore, VB 7 can now create Free Threaded apps and, finally, provides structured exception handling in the form of Try ... Catch blocks (similar to JScript's/C++'s/Java's method). For a full article on VisualBasic 7 language enhancements be sure to read: VisualBasic 7 Language Innovations.

Creating ASP.NET Pages with C#
C# is a new language from Microsoft that eerily resembles Java. If you enjoy/program in Java or C++, then you'll greatly benefit from being able to create ASP.NET pages with C#. Personally, I love C#'s syntax. It is similar to Java's. As with VisualBasic 7 (and with all Visual Studio 7 languages), C# is strongly typed. Unlike C++, C# prevents developers from making costly errors that lead to memory leaks and memory holes with automatic garbage collection.

I really can't provide a list of reasons why you should use C# over VisualBasic. For me, C# looks cool, and is fun to program! ASPFree.com has an article that lists the syntax for C# and VisualBasic side-by-side. Take a moment to check out that listing and see what syntax you find easier to read and use. Also, be sure to read Microsoft's article: C# Introduction and Overview.

One of the neatest things about ASP.NET pages is that they are compiled, not interpretted, like ASP pages. ASP.NET pages can be created with any NET Common Language Runtime-compliant compiler, which includes the full Visual Studio 7 line. The two most popular language choices for ASP.NET will likely be VisualBasic 7 and C#, although there are a number of other compliant compilers to choose from.

To learn more about ASP.NET be sure to read visit our ASP.NET Article Index.

Create ASP.NET Pages with JScript.NET
Add JScript to the list of NET Common Language Runtime-compliant compilers. ASP.NET pages can be created using this new JScript compiler. To learn more be sure to read Microsoft's article: Introducing JScript.NET!

Happy Programming!

ASP.NET [1.x] [2.0] | ASPFAQs.com | Advertise | Feedback | Author an Article