William Shakespeare,: The True Beginning of Our End
William Shakespeare,: The True Beginning of Our End
Language interoperability
Fully object-oriented languages
Common runtime engine shared by all
languages
Base class library usable by all languages
Simplified deployment
Better security
Better performance
.NET Framework 3.0 11 Introducing ASP.NET 2.0
Source: Lam and Tai, .NET Framework Essentials, 3rd Edition (O'Reilly, 2003).
.NET Components 13 Introducing ASP.NET 2.0
Language Compilers 14 Introducing ASP.NET 2.0
...
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.ver 1:0:5000:0
}
.assembly hello Metadata
{
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module hello.exe
// MVID: {F828835E-3705-4238-BCD7-637ACDD33B78} If we use the IL disassembler
.class private auto ansi beforefieldinit MainApp (ildasm.exe) to turn a binary
extends [mscorlib]System.Object assembly into a text assembly, we
{
.method public hidebysig static void Main( ) cil managed will see something similar to the
{ following:
.entrypoint
.maxstack 1
ldstr "C# hello world!"
call void [mscorlib]System.Console::WriteLine(string)
ret
} // End of method MainApp::Main MSIL Module
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{ Co de d ecla ratio n bl ock
myDate.Text = DateTime.Now.ToShortDateString();
}
</script>
<html>
<head><title>Hello World Embedded</title></head>
<body>
<form id="form1" runat="server" > Nec ess ary t o m ake t his a w eb for m
<h1>Hello World</h1>
The date is <em>
<asp:Label ID="myDate" runat="server"></asp:Label> We b server cont ro l
</em>
</form>
</body>
</html>
Page Directive 32 Introducing ASP.NET 2.0
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
myDate.Text = DateTime.Now.ToShortDateString();
}
</script>
<html>
<head><title>Hello World Embedded</title></head>
<body>
<form name="form1" method="post" action="HelloWorld.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJODExMDE5NzY5D2QWAgIDD2QWAgIBDw8WAh4EVGV4dAUKMDgvMDEvMjAwNmRkZDZPhFHJER
4chf3nmlgfL+uq4W58" />
<h1>Hello World</h1>
The date is <em>
<span id="myDate">23/06/2006</span> No tice no <asp:Label> con tr ol.
</em>
</form> No tice als o the hid den inp ut tag
</body> with th e name of __VI EWST AT E.
</html> We wil l lea rn mo re about this
view st ate in Ch apt er 2.
Example using Code-Behind 37 Introducing ASP.NET 2.0
<!DOCTYPE … >