August 12, 2002 - Writing the Hello World's ASP.NET Page
August 12, 2002 Writing the Hello World's ASP.NET Page Tips: August 2002
Yehuda Shiran, Ph.D.
|
helloworld.aspx
):
<%@ Page LANGUAGE="JScript" SRC="helloworld.aspx.js"
INHERITS="ASPPlus.codeBehind" %>
<HTML>
<HEAD>
<TITLE>Hello World Test</TITLE>
</HEAD>
<BODY STYLE="font-size:12; font-family:arial,verdana,sans-serif;">
<FORM RUNAT="server">
<P ALIGN="center"><ASP:LABEL ID="message" RUNAT="server"></ASP:LABEL></P>
</FORM>
</BODY>
</HTML>
The first line includes directives. It specifies the scripting language (LANGUAGE="JScript"
), the Code Behind file (SRC="helloworld.aspx.js"
), and the class name to inherit from (INHERITS="ASPPlus.codeBehind
"). The Web server looks for the class definition of ASPPlus.codeBehind
, as specified by the INHERITS
attribute. ASPPlus
is the namespace, or the package in JScript .NET terms. codeBehind
is the name of the class, as we have defined in helloworld.aspx.js
. The Web server looks for the binary representation of the ASPPlus.codeBehind
class in all dll
files included in the bin
directory underneath the current working directory of the ASP.NET page (helloworld.aspx
). If the Web server does not find this class, it will generate the dll
file from the code specified by the SRC
attribute.
The content of the ASP.NET page is straightforward. We have one ASP.NET control, ASP:Label
. Its important attribute is its ID
, message
. We set the message's Text
property to the Hello World
greeting, and in this way display this greeting on the screen.
To learn more about JScript .NET and ASP.NET, go to Column 115, JScript .NET, Part IX: Code Behind.