Web Platform Introduction With a focus on “free” Mike Taulty Developer & Platform Group Microsoft Ltd
The humble web request GET /default.html HTTP/ OK... Internet Information Services V5 (2000), V6 (2003), V7* (2008) can develop without IIS ASP.NET adds.NET to HTTP handling
The humble web request GET /default.html HTTP/ OK... Internet Information Services V5 (2000), V6 (2003), V7* (2008) can develop without IIS ASP.NET adds.NET to HTTP handling
Rest of the talk What’s.NET? Common aspects of ASP.NET Web Pages (.ASPX) Web Pages (.ASPX) Web Services (.ASMX) Web Services (.ASMX) Custom (.ASHX) Custom (.ASHX) Specific ASP.NET request handlers
Many languages, one framework Languages C# VB C++/CLI....NET Framework (The “class libraries”).NET Framework (The “class libraries”).NET Framework Core Services Threading I/O Network Collections Config... Diagnostics Security Resources Data XML Windows UI Web UI Workflow Comms void Foo() { MessageBox.Show("Hello World"); }
Many languages, one exe format.NET Assembly Metadata Code (CIL) compile void Foo() { MessageBox.Show("Hello World"); } C# Sub Foo() MessageBox.Show("Hello World") End Sub VB void Foo() { MessageBox::Show(L”Hello World”); } C++
Many languages, one runtime (CLR) Common Language Runtime (CLR) Class Loader IL to Native Compilers IL to Native Compilers Code Manager Code Manager Garbage Collector Garbage Collector Security Engine Debug Engine Type Checker Exception Manager Thread Support COM Marshaler Base Class Library Support.NET Assembly Metadata Code (CIL) Just In Time Native Code Native Code Verified? run
Versions of.NET Framework & Tools 2003 VS.NET 2003 Fx 1.1 VS.NET 2003 Fx VS.NET Fx 1.0 VS.NET Fx VS 2005 Fx 2.0 VS 2005 Fx Vista Fx 3.0 Vista Fx VS 2008 Fx 3.5 VS 2008 Fx 3.5.NET Framework is a free download Visual Studio comes in various editions Express, Standard, Professional, Team SQL Server also has an Express edition
Next... What’s.NET? Common aspects of ASP.NET Web Pages (.ASPX) Web Pages (.ASPX) Web Services (.ASMX) Web Services (.ASMX) Custom (.ASHX) Custom (.ASHX) Specific ASP.NET request handlers
Operation of built-in ASP.NET handlers GET /somefile.ext HTTP/ OK... somefile.extuser codegen’d code associated with* produces*.NET Class compiled into instantiate & call to produce response Instance
GET /somefile.ext HTTP/ OK... somefile.ext instantiate & call to produce response Instance.NET Class Operation of built-in ASP.NET handlers
ASP.NET Configuration All settings stored in XML files Applied hierarchically Library support Easy access to settings Easy extension to include custom settings machine.configweb.config /webSites/ site1 web.config
Next... What’s.NET? Common aspects of ASP.NET Web Pages (.ASPX) Web Pages (.ASPX) Web Services (.ASMX) Web Services (.ASMX) Custom (.ASHX) Custom (.ASHX) Specific ASP.NET request handlers
ASP.NET Web Pages Control-based framework for productive means of generating HTML Author a.ASPX file Use designer/text-editor to add controls, HTML and set properties Write Page class in code-behind
From text file to compiled code
From.ASPX file to compiled code GET test.aspx test_aspx generates & compiles System.Web.UI.Control controls collection System.Web.UI.Page ProcessRequest() void FrameworkInitialize() { controls.Add( new LiteralControl( “ ”)); } void FrameworkInitialize() { controls.Add( new LiteralControl( “ ”)); }
A page is a tree of controls Page Control render (HtmlWriter) Render()
A page contains a form
Pages (generally) post to “themselves” GET /default.aspx Page Control HTTP/ OK... POST /default.aspx Post Data Page Control IsPostback = True
At post-back, controls fire events
Controls “appear” to maintain state GET /default.aspx POST /default.aspx Post Data POST /default.aspx Post Data (incl VIEWSTATE) Post Data (incl VIEWSTATE) Apply VIEWSTATE
Pages go through a life-cycle
Lifecycle of a Page (simplified) InitLoad Pre- Render RenderUnload CreateChildControls, ViewState loaded (for post-backs) CreateChildControls, ViewState loaded (for post-backs) Server-Side events fired (for post-backs) Server-Side events fired (for post-backs) CreateChildControls (for non-post-backs) CreateChildControls (for non-post-backs) ViewState saved
Page “Feature Areas” Features Data Binding LoginProfileNavigationValidationSessionCaching
Databinding
Next... What’s.NET? Common aspects of ASP.NET Web Pages (.ASPX) Web Pages (.ASPX) Web Services (.ASMX) Web Services (.ASMX) Custom (.ASHX) Custom (.ASHX) Specific ASP.NET request handlers
ASP.NET Web Services Providing SOAP request/response framework “Automatic” construction of XML, SOAP and WSDL description Author a.ASMX file Write service class in code behind Attribute service class with WebService and WebMethod
ASP.NET Web Services
Next... What’s.NET? Common aspects of ASP.NET Web Pages (.ASPX) Web Pages (.ASPX) Web Services (.ASMX) Web Services (.ASMX) Custom (.ASHX) Custom (.ASHX) Specific ASP.NET request handlers
ASP.NET Custom Handlers Lower level mechanism for producing any response to an HTTP request Author a.ASHX file Write handler class in code behind Use provided HttpContext object Request property Response property
ASP.NET Custom Handlers
Summary ASP.NET released since 2002 Plus in to all shipping IIS versions Best affinity with IIS7 in Windows Server 2008 Executes.NET code to process requests Specific framework for Pages with many high- level controls for building a site Specific framework for Services
© 2007 Microsoft Ltd. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.