An Introduction to ASP 'NET - PowerPoint PPT Presentation

1 / 39
About This Presentation
Title:

An Introduction to ASP 'NET

Description:

VBScript Leverage VB Skills. 4. ASP .NET Intro. Advantages of Using ASP ... VBScript, JavaScript, CGI/Perl. C, C , C#, Java ... – PowerPoint PPT presentation

Number of Views:552
Avg rating:3.0/5.0
Slides: 40
Provided by: cscCol
Category:

less

Transcript and Presenter's Notes

Title: An Introduction to ASP 'NET


1
An Introduction toASP .NET
  • Chris Whitehead, MCSE
  • Columbus State University

2
Microsofts Claim
  • ASP.NET is a revolutionary programming framework
    that enables the rapid development of powerful
    web applications and services. Part of the
    emerging Microsoft .NET Platform, it provides the
    easiest and most scalable way to build, deploy
    and run distributed web applications that can
    target any browser or device.

3
ASP
  • Simple procedural programming model
  • Access to COM Objects
  • ADO
  • File system object
  • No compiling, just save
  • Support for Multiple Scripting languages
  • Mix HTML and Code
  • VBScript Leverage VB Skills

4
Advantages of Using ASP
  • Dynamic creation of Web pages
  • Easy connection and display of database
    information
  • Can perform form processing
  • Browser-independent
  • Can be tested on local machine
  • PWS 95/98/ME
  • IIS 2000/XP
  • Flexible server-side scripting capabilities
  • VBScript, JavaScript, CGI/Perl
  • C, C, C, Java
  • Pages can include both server-side scripting and
    client-side scripting

5
ASP Challenges
  • Code Readability
  • Mixed code html
  • Performance
  • Interpreted
  • PostBack Complexity
  • Had to manage postback manually
  • Reuse
  • DLL Locking
  • Permission Denied (Error 70)
  • Deployment
  • Sessions
  • Restricted To Inproc
  • Caching
  • Different Programming models, debuggers, IDEs etc

6
Why ASP .NET?
  • Solve the issues inherent in ASP
  • Enhanced performance
  • Power and flexibility
  • Simplicity
  • Manageability
  • Scalability and availability
  • Customizability and extensibility
  • Reliability
  • Security

7
Why ASP .NET? (2)
  • Make it easier to build web apps
  • Make it easier to deploy web apps
  • Make it easier to operate web apps
  • Provide greater performance, reliability, and
    scalability

8
What is ASP .NET
  • Not an ASP upgrade
  • Next-generation, unified Web development
    framework
  • New control-based, execution model for Web UI

9
ASP .NET Capabilities
  • Its really, really fast!
  • Deploy and upgrade running apps with XCOPY
  • Great tools support
  • Automatically detects and recovers from errors
  • Web farm scalable session state
  • Built-in output caching
  • Supports wide range of mobile devices
  • Uses compiled languages
  • Makes building web services easy
  • Much simpler page development model

10
Changes from Previous Versions
  • Requires .NET framework
  • Pages end in .aspx instead of .asp
  • Can process both .asp and .aspx
  • Expanded object library
  • Web services and server controls

11
PC Magazine Nile Application Test
Pages Served per Second
2800
8 CPU 4 CPU 2 CPU
2400
2000
1600
1200
748
637
800
330
400
Microsoft ASP
12
Developer Productivity
13
System Requirements
  • Requires a ASP processor on the server
  • For previous versions of ASP
  • Windows 95/98/ME/NT/2000/XP
  • Preinstalled with PWS or IIS
  • Linux add-in
  • For ASP .NET
  • Windows 2000
  • IIS 5.0
  • .NET Framework

14
Installation
  • Server
  • Download and install .NET Framework
    (http//www.asp.net/download.aspx)
  • Add ASPNET user

15
ASP .NET Configuration
  • Stored in XML file in directory with pages
  • web.config
  • Contains all ASP.NET settings
  • Authentication, compile options, custom error
    pages, etc.
  • Allows adding Application settings
  • DSN, URLs to WebServices, etc
  • Extensible
  • Can extend with custom configuration data

16
The .NET Framework
Visual Studio.NET
VB
C
C
JScript

Common Language Specification
WindowsForms
ASP.NET Web Services and Web Forms
WindowsForms
ADO.NET Data and XML
Base Class Library
Common Language Runtime
17
ASP .NET Concepts
  • Server controls
  • Encapsulate UI generation, user interaction
  • Fire events for state changes
  • Staged page execution
  • Page fires events for phases of processing
  • Init, Load, Render, Unload, etc
  • Event handler code
  • Handles events raised by controls, page
  • Can be located in-line, or in separate file or
    DLL

18
ASP .NET Server Controls
  • Programmable, server-side objects
  • Properties, methods and events
  • Encapsulate both behavior and rendering
  • HTML, XML, WML, script, etc.
  • You can create server controls
  • Custom controls
  • User controls
  • Or derive from existing controls

19
Web Forms
  • A Web Form combines declarative tags (HTML, ASP
    directives, server controls and static text) with
    code
  • However, good separation provided between code
    and tags

separate files
single file
lttagsgt
lttagsgt
code
code
Form1.aspx
Form1.aspx
Form1.vb
20
Web Forms (2)
  • 45 Built In Controls
  • Target any HTML 3.2 browser
  • Raise Events to Server
  • Basic Controls
  • textbox, checkbox, radio, button
  • Advanced Controls
  • AdRotator, Calendar, DataGrid, Validator

21
Web Services in ASP .NET
  • Simple Programming Model
  • Author .ASMX Files with Class Methods
  • ASP.NET compiles on demand, generates contract,
    exposes HTML information page
  • Incoming HTTP requests invoke methods
  • No special HTTP or XML knowledge needed
  • Supports Multiple Message Wire Formats
  • HTTP Get, Post, and SOAP Requests

22
ASP Architecture
ASP
.ASP
Request for Page
23
ASP .NET Architecture
ASPX
.ASPX
Request for Page
24
ASP .NET Architecture (2)
.ASPX
Compiled
First Request for Page
25
ASP .NET Architecture (3)
Subsequent Request for Page
26
ASP .NET Architecture (4)
Page is modified
27
ASP .NET Syntax
  • Requires lt and gt enclose any ASP scripting
  • Scripting can be placed in any location in a Web
    page provided it is enclosed in the delimiters

28
Hello World Example
  • lthtmlgt
  • ltheadgt
  • lttitlegtHello Worldlt/titlegt
  • ltbodygt
  • lt response.write (Hello World!) gt
  • lt/bodygt
  • lt/htmlgt
  • Save as helloworld.aspx

29
Server Controls
  • Used in addition to or instead of lt gt to
    control Web page
  • Use runatserver attribute

30
More on Server Controls
  • Previous form
  • ltform action process.aspgt
  • ltinput type text name mytextboxgt
  • lt/formgt
  • With server controls
  • ltform action process.aspx method-post runat
    servergt
  • ltasptextbox id MyTextBox runat server
    /gt
  • lt/formgt

31
Data Controls
  • Bind to many data sources
  • Collections
  • Array
  • HashTable
  • Dictionary
  • ADO.NET
  • DataReader
  • DataSet
  • XML
  • Can bind data to virtually any control
  • Eg textbox, listbox more specific
    data-orientated controls (eg datagrid)

32
Data Controls
Data Controls
33
ASP.NET Web Applications
  • Global ASAX
  • Application Variables
  • Session State
  • Web Configuration
  • i.e properties of the web site

msdn.microsoft.com
34
Web ApplicationsGlobal.ASAX
  • First Request
  • Application_Start
  • First Request for Each User
  • Session_Start
  • Each Request
  • Application_BeginRequest
  • Application_Authenticate
  • Application_EndRequest
  • Application Error
  • Application_Error
  • User Logs Out/Session Times Out
  • Session_End
  • Web Server Shutdown
  • Application_End

msdn.microsoft.com
35
ASP .NET Web ApplicationsConfig.Web
  • Site Configuration file
  • Like an .INI file for your site
  • XML format
  • Extensible
  • Some settings
  • Security
  • Session
  • Localization
  • Tracing
  • Debugging

msdn.microsoft.com
36
ASP .NET Web ApplicationsSession Variables
  • Store state information
  • No longer require Cookies
  • Share between servers
  • ltsessionstate
  • inproc"false"
  • serverAnotherServer"
  • port"42424"
  • /gt

msdn.microsoft.com
37
Caching
  • Output caching
  • Serves rendered result of a page from cache
  • Big performance win cached pages are as fast as
    static pages
  • Vary by params, language, user-agent
  • Cache API
  • Enables arbitrary objects to be cached
  • Example result of database query
  • Can be a big performance win

38
Improved Deployment
  • Components can be dynamically updated
  • No more locked DLLs
  • Just copy new DLL on top of old one
  • No tools, no configuration changes, no app
    shutdown, no re-boots
  • Works great with content replication systems

39
Improved Reliability
  • ASP.NET has been designed with assumption that
    failures will occur on systems
  • Designing for failure reduced fragility
  • Detects/recovers from common problems
  • Access Violations, Memory Leaks, Deadlocks
  • Pre-emptive cycling of applications
  • Time and Request Based Settings
  • Net Result Users should never think that an
    ASP.NET application is down or unavailable

40
Migrating From ASP
  • http//msdn.microsoft.com/library/default.asp?url
    /library/en-us/dnaspp/html/aspnetmigrissues.asp
  • Guidelines for existing ASP Solutions
  • Use Option Explicit
  • Avoid Using Default Properties
  • Use Parentheses and the Call Keyword
  • Avoid Nested Include Files
  • Organize Utility Functions into Single Files
  • Remove Code from Content as much as Possible
  • Do Not Declare Functions Inside lt gt Blocks
  • Avoid Render Functions
  • Explicitly Free Resources (Call Close Methods)
  • Avoid Mixing Languages

msdn.microsoft.com
41
ASP .NET Resources
  • 123aspx.com
  • ASPFree.com
  • ASPNG.com
  • ASP Today
  • ASPAlliance
  • 4GuysFromRolla.com
  • ASPWorkshops.com
  • 411ASP.NET
  • ASPX101.net
  • ASP.net
  • MSDN.Microsoft.com

42
Summary
  • ASP.NET is a rich web application platform
  • Combines simplicity and power
  • Easy to deploy and maintain
  • Reliable, highly available and scalable
  • Its really, really fast!
Write a Comment
User Comments (0)
About PowerShow.com