ASP.net Intro

download ASP.net Intro

of 20

Transcript of ASP.net Intro

  • 7/28/2019 ASP.net Intro

    1/20

    An Introduction to ASP.NetFramework and Development Platform

    IT 4203 Advanced Web Development

    Jack G. ZhengFall 2010

    http://www.spsu.edu/
  • 7/28/2019 ASP.net Intro

    2/20

    Overview ASP.Net application platform

    Underlying platform: .Net Framework Application server: ASP.Net runtime

    Development tool: Visual StudioProgramming language: C#, VB.Net, etc.Web server: IIS

    2

  • 7/28/2019 ASP.net Intro

    3/20

    .Net Platform ArchitectureThe .NET Frameworkis Microsoft's platformon Windowsoperating systemsthat supports buildingand running softwareapplications

    The .Net Framework

    has two corecomponents:Common LanguageRuntime (CLR)Class Library

    3

    The relationship of the CLR and the class library to the overall systemhttp://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspx

    http://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspx
  • 7/28/2019 ASP.net Intro

    4/20

    Common Language Runtime (CLR)CLR is a software component layer between operatingsystems and applications.

    All .NET programs execute under the supervision of the CLRThe CLR manages code at execution time, providing standardruntime services, such as memory management, thread

    management, exception handling, security, compilation,verification of code safety and other forms of code accuracy, etc.

    Manage codeCode that targets the runtime (managed by the CLR)

    Unmanaged codeCode that does not target the runtime (not managed by the CLR)

    4

  • 7/28/2019 ASP.net Intro

    5/20

  • 7/28/2019 ASP.net Intro

    6/20

    Class LibraryThe .NET Framework class library is a comprehensive, object-orientedcollection of reusable classes, interfaces, and value types that providesaccess to system functionalities

    Class library is available to all languages using the .NET Framework.

    Class library is organized into namespaces, which groups classes intohierarchical sets by functionalities and purposes. For example:System contains fundamental classes and base classes that define commonlyused value and reference data types, events and event handlers, interfaces,attributes, and processing exceptions.System.Web provides classes and interfaces that enable browser-server communication.

    System.Web.UI provides classes and interfaces to create ASP.NET server controls and ASP.NET Web pages for the user interface of ASP.NET WebapplicationsVisit the class library reference here

    http://msdn.microsoft.com/en-us/library/ms229335(v=VS.90).aspx

    6

    http://msdn.microsoft.com/en-us/library/ms229335(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/ms229335(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/ms229335(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/ms229335(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/ms229335(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/ms229335(v=VS.90).aspx
  • 7/28/2019 ASP.net Intro

    7/20

    Interoperation and IntegrationThe .NET Framework can be hosted byunmanaged components that load the CLRinto their processes and initiate the executionof managed code.

    For example, CLR can be hosted byunmanaged applications such as Microsoft

    SQL Server, Internet Information Services(IIS), and Internet Explorer. This enables theuse of managed code to write business logic.

    7

  • 7/28/2019 ASP.net Intro

    8/20

    .Net Framework Versions and Stack

    Image fromhttp://en.wikipedia.org/wiki/.NET_Framework

    8

    http://upload.wikimedia.org/wikipedia/commons/d/d3/DotNet.svghttp://en.wikipedia.org/wiki/.NET_Frameworkhttp://upload.wikimedia.org/wikipedia/commons/d/d3/DotNet.svghttp://en.wikipedia.org/wiki/.NET_Framework
  • 7/28/2019 ASP.net Intro

    9/20

    ASP.Net ASP.Net is the component to support webapplications and services

    ASP.Net major featuresCompiled execution: ASP.NET will automaticallydetect any changes, dynamically compile the files if needed, and store the compiled results to reuse for subsequent requests.

    Rich class framework: making full use of the .Netframework class library and third party components.Flexible language optionsObject-oriented programming model

    9

  • 7/28/2019 ASP.net Intro

    10/20

    Creating a Web Site Project inVisual Studio

    Major settingsType/template: choose local file systemLocation: choose a specific working folder

    .Net Framework version: choose 3.5Language: choose C#

    A solution file (.sln) will be addedNote that the solution files are not located in your Web sites folder because they are specific toVisual Studio 2008 and are not required in thedeployed Web site.

    10

  • 7/28/2019 ASP.net Intro

    11/20

    ASP.Net Web Site StructureSpecial system folders

    See the table on the right

    Major file typesWeb form (.aspx file): a major form of ASP.Net pagesClass file (.cs file): user written class source fileUser control (.ascx): web form(page) components to beincluded in a container page.Web.config: Web site

    configuration file under theroot directory of the web siteOther common web contentfiles: HTML, image, script,style, etc.

    11

  • 7/28/2019 ASP.net Intro

    12/20

    Creating a Web FormTwo web form programming model

    Single-File Page (inline code): a single web page filecontains both server-side code and HTML.Code-Behind Page: this model physically separatesthe user interface layout markup and the server-sidecode into two distinct files.

    A .aspx page contains the layout markup (HTML) A related .aspx.cs file contains the associated code.

    Hybrid modelIn code behind model, code blocks can also be placedirectly into the .aspx file.

    12

  • 7/28/2019 ASP.net Intro

    13/20

    ASPX Page StructureEach page is effectively a class that inherits from theSystem.Web.UI.Page class

    Each aspx page consists of general web page content (HTML,JavaScript, Style, Head, Body, etc.) and ASP.Net code blocks

    Embedded code blocks in the layout page (.aspx): the page directive is used to the environment, specifyinghow the page should be processed. : defining class level variables,functions and methods.: for normal procedure code that are usually within a method; canbe mixed with normal web page content, such as HTML and JavaScript: expression for a single value output; equivalent toResponse.Write(); can be mixed with normal web page content, such asHTML and JavaScript: comment.

    13

  • 7/28/2019 ASP.net Intro

    14/20

    Code Behind Exampleschedule.aspx has this line of code at the top of the page

  • 7/28/2019 ASP.net Intro

    15/20

  • 7/28/2019 ASP.net Intro

    16/20

  • 7/28/2019 ASP.net Intro

    17/20

    Development ToolsVisual Studio

    Microsofts flagship software development environment product for developing applications on various .Net frameworks and Windowsplatforms.

    Visual Studio ExpressExpress edition is a lightweight version of Visual Studio with reducedfunctionalities.Microsoft provides the "Express" edition free of charge.

    Expression Web A general HTML editor and web design softwareProvides more design support than programming support

    Microsoft Windows SDKhttp://en.wikipedia.org/wiki/Microsoft_Windows_SDK

    17

    http://en.wikipedia.org/wiki/Microsoft_Windows_SDKhttp://en.wikipedia.org/wiki/Microsoft_Windows_SDK
  • 7/28/2019 ASP.net Intro

    18/20

    Internet Information Services (IIS)IIS is an advanced web server with extensions created byMicrosoft on Windows

    IIS and ASP.NetIIS provides seamless support for ASP.Net runtime and

    applicationsIIS can host multiple ASP.Net applications with different .Netframework versions

    IIS major versionsIIS 5.0, Windows 2000IIS 5.1, Windows XP ProfessionalIIS 6.0, Windows Server 2003IIS 7.0, Windows Server 2008 and Windows VistaIIS 7.5, Windows Server 2008 R2 and Windows 7

    18

  • 7/28/2019 ASP.net Intro

    19/20

    SummaryKey concepts

    .Net Framework and its core components: CLR, Class LibraryUnderstand the .Net application compilation process: CIL, JIT Complier Managed code, unmanaged codeNamspace

    ASP.Net and its major featuresIIS, Visual Studio

    Key technical points and skillsKnow how to use Visual Studio or Expression Web to create and run aweb site projectKnow special folders and major file typesKnow ASP.Net page code blocksUnderstand the difference between single-file page and code-behindpage model

    19

  • 7/28/2019 ASP.net Intro

    20/20

    Additional Readings.NET Framework Conceptual Overview

    http://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspx

    .Net Frameworkhttp://en.wikipedia.org/wiki/.NET_Framework

    ASP.NET Integration with IIS 7http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/

    20

    http://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspxhttp://en.wikipedia.org/wiki/.NET_Frameworkhttp://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/http://en.wikipedia.org/wiki/.NET_Frameworkhttp://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspxhttp://msdn.microsoft.com/en-us/library/zw4w595w(v=VS.90).aspx