ASP'NET - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

ASP'NET

Description:

Resides in a folder on a web server (IIS) The web site is configured ... dll assembly of compiled codebehind and other classes. Global Programming (Global.asax) ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 24
Provided by: busOreg
Category:
Tags: asp | net | ado

less

Transcript and Presenter's Notes

Title: ASP'NET


1
ASP.NET
2
Microsoft .NET Framework
XML Web Services
Web Forms
Windows Forms
ASP.NET
C VB.NET J C
Data and XML Classes
Base Framework Classes
Common Language Runtime
3
Overview
MyPage.aspx
HttpHandler(.aspx)
Page
HtmlForm
Http Application
Button
TextBox
Http Module (Authorization)
Http Module (Authentication)
Http Module (OutputCache)
ASP.NET Runtime (ISAPI)
IIS (Web Server)
Internet
4
ASP.NET Application
  • Resides in a folder on a web server (IIS)
  • The web site is configured for ASP.NET, meaning
    it is set to handle .aspx page requests by
    sending them to the ASP.NET Runtime
  • web.config application configuration file
  • Aspx files
  • .dll assembly of compiled codebehind and other
    classes

5
Global Programming (Global.asax)
  • Define Application Global methods, constants,
    variables
  • Global Event Handling
  • Application_Start
  • Session_Start
  • Application_BeginRequest
  • Application_AuthenticateRequest
  • Useful for setting up custom Page.User and roles
  • Application_Error
  • Session_End
  • Application_End

6
ASP.NET Application Configuration
  • Settings in machine.config
  • Settings in web.config
  • ltcustomErrorsgt
  • lttracegt
  • ltsessionStategt
  • ltappSettingsgt
  • ltaddgt
  • key attribute
  • value attribute
  • Security Settings
  • ltauthenticationgt
  • ltauthorizationgt
  • ltidentitygt

7
ASP.NET Security Configuration
  • ltauthenticationgt
  • Windows
  • Forms
  • Passport
  • ltauthorizationgt
  • ltallowgt
  • ltdenygt
  • ltidentitygt
  • impersonate attribute
  • userName and password attributes
  • Can be stored encrypted in the registry

8
ASP.NET Application Security
  • Page.User
  • Identity
  • GenericPrincipal and Roles
  • PrincipalPermission and IsInRole
  • IIS Configuration
  • Interaction with Application Security
  • Integrated, Basic, Digest, Kerberos
  • Accessing Backend Resources (Architecture)

9
System.Web.UI.Page
  • ASP.NET Web Page Consists of
  • An .aspx page
  • An optional .NET class file containing code for
    that page
  • Any user controls used by the page
  • Think of the page as an object
  • Controls are object variables
  • Access them in code
  • Inline (Inferior)
  • Code is interspersed with HTML
  • Code Behind (Superior)
  • Code resides in a separate class file

10
The Page Directive
  • Defines page-specific (.aspx file) attributes
    used by the ASP.NET page parser and compiler.
  • Example showing an .aspx page mapped to its
    code behind
  • lt_at_ Page Codebehind"WebForm1.aspx.vb"
    inherits"AspNet.WebForm1" gt

11
Server-Side Events
Client
Server
MyPage.aspx
Private Sub btnGo_Click() End Sub
Search
PostBack
12
Event flow in ASP.NET pages (.aspx)
  • Application Level Events (Global.asax)
  • Page_Init page and controls are initialized
  • Page_Load all the controls and page are loaded
  • Change events for controls are processed
  • Click events for controls are processed
  • Page_PreRender page is about to render
  • Page_Unload page is unloaded from memory

13
Controls
  • WebForm Controls
  • HTML Controls
  • Web User Controls
  • Custom Controls

14
Whats in the Toolbox?
  • WebForm Controls
  • TextBox, Label, Hyperlink, Etc
  • DropDownList, DataGrid, DataList, Etc
  • HTML Controls (Client or Server)
  • ADO.NET Design Controls
  • System Components
  • Validation Controls

15
WebForm Vs HTML Controls
  • Both have the following benefits
  • An object model that you can program against on
    the server 1
  • A set of events for which you can write sever
    side event handlers. 1
  • The ability to handle events in client script . 1
  • Automatic maintenance of the control's state
    (ViewState). 1
  • Interaction with validation controls so you can
    easily verify that a user has entered appropriate
    information into a control. 1
  • Data binding to one or more properties of the
    control. 1
  • Support for HTML 4.0 styles if the Web Forms page
    is displayed in a browser that supports cascading
    style sheets. 1
  • Pass-through of custom attributes. 1
  • HTML Controls Advantage
  • Object model with a one-to-one mapping to HTML
    elements 1
  • WebForm Controls Advantage
  • A richer object model that provides type-safe
    programming capabilities. 1
  • Automatic browser detection. 1
  • For some controls, the ability to define your own
    look for the control using templates. 1
  • For some controls, the ability to specify whether
    a control's event causes immediate posting to the
    server or is instead cached and raised when the
    form is submitted. 1
  • Ability to pass events from a nested control
    (such as a button in a table) to the container
    control. 1

1 Ref Introduction to ASP.NET Server
Controlsms-help//MS.VSCC.2003/MS.MSDNQTR.2003FEB
.1033/vbcon/html/vbconintroductiontowebformscontro
ls.htm2 See Also ASP.NET Server Controls
Recommendationsms-help//MS.VSCC.2003/MS.MSDNQTR.
2003FEB.1033/vbcon/html/vbconchoosingwebformscontr
ols.htm
16
Validation Controls
  • RequiredFieldValidator
  • CompareValidator
  • RangeValidator
  • RegularExpressionValidator
  • CustomValidator
  • ValidationSummary

17
Validation Controls Common Properties
  • ControlToValidate ? This property lets the
    validator know which control it has to validate.
    (It binds the validator to that control and then
    the validator monitors that control.)
  • ErrorMessage ? This is the error message that
    appears in the validation summary when the
    control being validated violates the condition
    set by the validator.
  • Text ?Information that gives guidance to correct
    the error.

18
Page.Validate() and Page.IsValid
  • They allow you to trigger validation from
    different points in your code
  • Validate() must be called before checking IsValid

19
DataBinding
  • Populating Controls with Data
  • Single-Value vs. Multi-Record
  • Design-time vs. Runtime Binding

20
How State is Managed in a Stateless World
  • Posted Data Handling
  • ViewState
  • Webforms automatically handles form data and
    persists it across requests
  • Hidden field with encoded data
  • Session (in memory or a database)
  • Cache

21
OutputCache
  • Cache the HTML output of a page
  • Increases performance
  • Duration
  • Location
  • VaryByParam

22
Debugging ASP.NET
  • Using Visual Studio .NET debugging tools
  • Breakpoints
  • Stop keyword
  • System.Diagnostics.Debug
  • Command/Immediate Windows
  • Watch/Quick Watch
  • Autos/Locals Windows
  • Trace
  • Client Script Debugging
  • Active Documents
  • Debugger keyword

23
Deployment
  • Can be XCopyd
  • Usually only the .aspx pages and the compiled
    codebehind assembly
Write a Comment
User Comments (0)
About PowerShow.com