330 likes | 448 Views
Web Platform Introduction With a focus on “free” . Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com http://www.mtaulty.com. The humble web request. Internet Information Services V5 (2000), V6 (2003), V7* (2008) can develop without IIS
E N D
Web Platform IntroductionWith a focus on “free” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com http://www.mtaulty.com
The humble web request • Internet Information Services • V5 (2000), V6 (2003), V7* (2008) • can develop without IIS • ASP.NET adds .NET to HTTP handling GET /default.html HTTP/1.1 200 OK ...
The humble web request • Internet Information Services • V5 (2000), V6 (2003), V7* (2008) • can develop without IIS • ASP.NET adds .NET to HTTP handling GET /default.html HTTP/1.1 200 OK ... IIS Run compiled .NET code Authenticate (optional) Execute Handler ASP.NET Send Response (log, etc)
Rest of the talk What’s .NET? Common aspects of ASP.NET Specific ASP.NET request handlers Web Pages (.ASPX) Web Services (.ASMX) Custom (.ASHX)
Many languages, one framework .NET Framework void Foo() { MessageBox.Show("Hello World"); } Languages Web UI Windows UI C# VB C++/CLI ... Workflow Comms Core Services Threading Network Resources Data XML I/O Config Diagnostics .NET Framework (The “class libraries”) Collections Security ...
.NET Assembly Metadata Code (CIL) Many languages, one exe format void Foo() { MessageBox.Show("Hello World"); } Sub Foo() MessageBox.Show("Hello World") End Sub void Foo(){ MessageBox::Show(L”Hello World”);} compile C# compile VB compile C++
Base Class Library Support Native Code 0101010101 0101010101 0101010101 0100101011 Thread Support COM Marshaler .NET Assembly Type Checker Exception Manager Metadata Verified? Security Engine Debug Engine Just In Time Code (CIL) IL to Native Compilers Code Manager Garbage Collector Class Loader Many languages, one runtime (CLR) run Common Language Runtime (CLR)
Versions of .NET Framework & Tools • .NET Framework is a free download • Visual Studio comes in various editions • Express, Standard, Professional, Team • SQL Server also has an Expressedition VS .NET Fx 1.0 VS .NET 2003 Fx 1.1 VS 2005 Fx 2.0 Vista Fx 3.0 VS 2008 Fx 3.5 2002 2003 2005 2006 2007
Next... What’s .NET? Common aspects of ASP.NET Specific ASP.NET request handlers Web Pages (.ASPX) Web Services (.ASMX) Custom (.ASHX)
Operation of built-inASP.NET handlers associated with* user code gen’d code GET /somefile.ext somefile.ext produces* compiled into .NET Class HTTP/1.1 200 OK ... instantiate & call to produce response Instance
Operation of built-inASP.NET handlers GET /somefile.ext somefile.ext .NET Class HTTP/1.1 200 OK ... instantiate & call to produce response Instance
ASP.NET Configuration web.config web.config /webSites/ machine.config web.config • All settings stored in XML files • Applied hierarchically • Library support • Easy access to settings • Easy extension to include custom settings site1
Next... What’s .NET? Common aspects of ASP.NET Specific ASP.NET request handlers Web Pages (.ASPX) Web Services (.ASMX) Custom (.ASHX)
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 .ASPX file to compiled code System.Web.UI.Control controls collection GET test.aspx System.Web.UI.Page ProcessRequest() test_aspx test.aspx void FrameworkInitialize() { controls.Add( new LiteralControl( “<html><body>.......”));} generates & compiles
A page is a tree of controls render (HtmlWriter) Page Render() Control Control Control Render() Render() Render() <html> <body> <ul> Control Control <li> <li> Render() Render() </ul> <input/> <a/> </body> </html>
Pages (generally) post to “themselves” GET /default.aspx Page Page HTTP/1.1 200 OK ... Control Control Control Control Control Control IsPostback = True POST /default.aspx Control Control Control Control Post Data HTTP/1.1 200 OK ...
Controls “appear” to maintain state GET /default.aspx POST /default.aspx Post Data POST /default.aspx Post Data (incl VIEWSTATE) Apply VIEWSTATE
Init Lifecycle of a Page (simplified) CreateChildControls, ViewState loaded (for post-backs) Unload Load CreateChildControls (for non-post-backs) ViewState saved Render Pre-Render Server-Side events fired (for post-backs)
Next... What’s .NET? Common aspects of ASP.NET Specific ASP.NET request handlers Web Pages (.ASPX) Web Services (.ASMX) Custom (.ASHX)
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
Next... What’s .NET? Common aspects of ASP.NET Specific ASP.NET request handlers Web Pages (.ASPX) Web Services (.ASMX) Custom (.ASHX)
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 • Requestproperty • Responseproperty
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