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

Sections:
Sample Chapters
Commonly Asked Message Board Questions
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
XML Info
Information:
Feedback
Author an Article
ASP ASP.NET ASP FAQs Message Board Feedback
Print this page.
Published: Friday, May 18, 2001

An Examination of .NET and How and Where ASP.NET Fits In, Part 3

By Scott Mitchell


  • Read Part 1
  • Read Part 2

  • In Part 2 we looked at the two most important parts to .NET: the CLR and the .NET Framework classes. In this final part, we'll examine how and where ASP.NET fits into the picture!

    - continued -

    ASP.NET - Where Does it Fit within .NET?
    ASP.NET is Microsoft's next "version" of ASP - it is basically ASP utilizing the .NET factors described in the last two parts of this article. That means that ASP.NET pages need to be created with .NET-compatible languages, which include VB.NET, C#, and JScript.NET.

    When an ASP.NET page is visited via a Web browser, the ASP.NET engine first checks to see if there already exists an up-to-date version of the IL code for the ASP.NET page. If there does, this IL is squirted to the CLR, and the HTML output generated by the ASP.NET page is then sent to the client's browser that requested the ASP.NET Web page. If, however, the IL does not exist at all or the ASP.NET page's source code has changed since the last IL was generated, the ASP.NET page must be recompiled. Depending on what language the ASP.NET page was written in, the proper compiler is instantiated and the IL created. This IL is saved on disk so that, for future requests, this recompilation, an expensive process, does not need to recur.

    If you've created ASP.NET pages, you most likely aware of the concept of Web controls. These are controls that can be used in an ASP.NET Web page to produce HTML elements like text boxes, labels, list boxes, etc. For example, to create a text box using a Web control, one can do:

    <asp:textbox id="Name" runat="server" />

    In fact, an ASP.NET Web page can contain a mix of server-side code (in server-side SCRIPT blocks) along with in-line HTML, like:

    <script language="VB" runat="Server">
      Sub Page_Load(sender as Object, e as EventArgs)
        lblMessage.Text = "Hello, World!"
      End Sub
    </script>
    
    <html>
    <body>
      <h1>Simple ASP.NET Demo</h1>
      <asp:label id="lblMessage" runat="server" />
    </body>
    </html>
    

    So how does that HTML/server-side code get translated into something that the VB.NET compiler can understand? One of the ASP.NET engine's most important tasks is translating the HTML/server-side code into a class that the VB.NET compiler (or C# or JScript.NET compilers) can understand. This process is a difficult one, and beyond the scope of this article; however, do be aware that your pages are turned into a class that inherits from the Page class (one of the classes in the .NET Framework). In fact, all of the Web controls that you can use in your ASP.NET Web pages are represented as classes in the .NET Framework. Additionally, any ad hoc HTML code in your ASP.NET Web page is captured and represented as an instance of the LiteralText class. Due to these translations, it is no understatement to say that ASP.NET Web pages are, indeed, actual running programs. No longer is a dynamic Web page just some simple script.

    If you've not worked with ASP.NET, I highly recommend that you download and try it out. As of the time of this writing (May 18th, 2001), it is still only in Beta 1, but Beta 2 is scheduled to come out by this year's TechEd (June 17th). Having been personally using ASP.NET for the past year, I can tell you that ASP.NET is:

    1. Way cool, and
    2. Way powerful

    You can do some really impressive tasks really easily with ASP.NET, tasks that required hundreds of lines of messy code in classic ASP. To learn more about ASP.NET be sure to read up on the articles listed in the ASP.NET Article Index.

    Happy Programming!

  • By Scott Mitchell


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