Developing WebApplications with ASP'NET - PowerPoint PPT Presentation

Loading...

PPT – Developing WebApplications with ASP'NET PowerPoint presentation | free to download - id: 15062e-M2EyY



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Developing WebApplications with ASP'NET

Description:

WebForms. In essence a self-posting page, able to handle events on client in server-side code ... WebForms as the basis of WebApplication. System.Web.UI.Page is ... – PowerPoint PPT presentation

Number of Views:557
Avg rating:3.0/5.0
Slides: 24
Provided by: alexth
Learn more at: http://www.alexthissen.nl
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Developing WebApplications with ASP'NET


1
Developing Web-Applications with ASP.NET
  • WebForms and XML Web Services
  • Alex Thissen

2
Agenda
  • Creating Web Forms
  • Web Forms and Server controls
  • Code behind
  • Session state
  • Security
  • Web Services
  • Consuming Web Services
  • Creating Web Services

3
Problems of ASP the old way
  • ASP pages do not behave like WinForms (without a
    lot of work)
  • Lots of code throughout HTML
  • Script Engine (VBScript of JScript) executes code
    line by line
  • Script languages are not strongly typed and have
    problems with COM interfaces

4
From old to new
  • Change extension to .aspx
  • Apply attributes id and runat to tags
  • Remove unnecessary attributes from elements (such
    as forms)
  • This is OK for upgrading, but not the preferred
    way

5
WebApplications
  • Thin client front-end to server application
  • Web pages behave like forms
  • One page handles all interaction from client
  • Stateful controls (no reset pages)
  • The Challenges
  • Internet is disconnected environment no lasting
    connection to server
  • Internet and security
  • Large and diverse browser audience

6
WebForms
  • In essence a self-posting page, able to handle
    events on client in server-side code
  • Framework provides an object model
  • Contains both client and server-side code
  • Uses Web Controls

7
WebForm client-server interaction
IIS Web Server file.aspx
server control
Browser
on first request HTML is sent
lthtmlgt ltbodygt ltaspTextBox /gt
lt/bodygt lt/htmlgt
lthtmlgt ltbodygt ltinput typetext gt
lt/bodygt lt/htmlgt
server round trips client-side events trigger
server-side event handlers
8
ASP.NET programming model
  • WebForms as the basis of WebApplication
  • System.Web.UI.Page is base class for WebForms
  • All of the original objects still available as
    part of Page object (though enhanced)
  • Session, Application, Request, Response, Server

9
Server controls
  • Server-side representations of client-side
    controls
  • Server controls are also browser-specific HTML
    generators (behavior and rendering)
  • Distinguishable by attributes id and
    runatserver
  • Two main categories
  • HTML Controls
  • Web Controls Intrinsic, Validation, Rich and
    List-bound
  • Create your own user controls

10
Compiled code
  • Increased performance through compilation of code
  • All .aspx pages are compiled into separate
    assemblies stored in temporary directories
  • Shadow copies are made to prevent locking of
    dlls
  • Framework registers File Change notifications on
    NTFS to detect changes to source files

11
Code behind
  • .aspx page can use a System.Web.UI.Page derived
    class stored in separate file
  • Use srcmycode.vb in Page directive
  • Such files are automatically built
  • No compiler arguments can be provided. Instead
    use
  • lt_at_ Import NamespaceSystem.Datagt
  • lt_at_ Assembly NameSystem.Datagt
  • Visual Studio.NET has its own approach for
    code-behind files (single .dll file)
  • Click Show All Files button
  • codebehind attribute

12
User controls
  • Use .ascx entension
  • Different directivelt_at_ Control LanguageVB
    Classgt
  • Contain only HTML that needs to be displayed (no
    ltHEADgt or ltBODYgt, etc.)
  • Need to be registered on page that uses themlt_at_
    Register TagPrefixtwice TagNameScoreWatcher
    Srcfile.ascxgt
  • Output caching can be applied at control level

13
Security
  • Security features provided by
  • Internet Information Server
  • NTFS
  • ASP.NET Framework
  • Authentication options for ASP.NET
  • Windows Integrated
  • Passport
  • Forms Authentication

14
Debugging and tracing
  • Server-side debugging
  • Tracing
  • web.config configures entire application
  • Page level directive (overrules web.config)
  • Trace object (Warn and Write methods)
  • When pageOutputfalse use trace.axd

15
Session State
  • ASP session state more of a burden
  • ASP.NET solves several problems
  • cookieless sessions
  • Separate process for isolation (WebFarms)
  • SQL Server database for session storage(durable,
    survives system crashes)

16
ASP.NET Session State Architecture
inetinfo.exe (IIS 4.0-5.1)
aspnet_isapi.dll(ASP.NET ISAPI Extension)
aspnet_wp.exe (ASP.NET worker process)
HTTP Request handler
aspnet_state.exe (ASP.NET session process)
17
Deployment
  • Most of time
  • XCOPY deployment in inetpub\wwwroot
  • Create virtual directory on target folder
  • Web Setup Project
  • Assemblies contain own metadata
  • Pages and source files compiled on-the-fly
  • Catches
  • COM Application need administration
  • Global Assembly Cache installation (gacutil.exe)
  • Security roles and users (OS and/or database)

18
Where do WebServices fit in?
Visual Studio.NET
.NET Enterprise Servers
BuildingBlock Services
.NET Framework
COM
Windows.NET
19
Web Services
  • A Web Service is programmable application logic
    accessible through standard Web protocols
  • Web site functionality and data without UI
  • Several open industry standards (Platform and
    Vendor independent)
  • XML (eXtensible Markup Language)
  • SOAP (Simple Object Access Protocol)
  • WSDL (Web Service Description Language)
  • UDDI (Universal Description, Discovery and
    Integration)
  • DISCO (Discovery)

20
Web Services in practice
Web Service
Design-Time or Dynamic
Runtime
21
Anatomy of WSDL document
describes SOAP parameters
ltdefinitionsgt lttypesgt lt/typesgt ltmessagegt ltpar
tgtlt/partgt lt/messagegt ltportTypegt ltoperationgt
lt/operationgt lt/portTypegt ltbindinggt ltoperati
ongtlt/operationgt lt/bindinggt ltservicegt ltportgtlt/p
ortgt lt/servicegt lt/definitionsgt
describes messages
parameters/return values
defines method calls pairs together
inputs/outputs
details on how to communicate with service
defines the service
ways to communicate with service
22
Building clients for Web Services
  • There are many ways to implement a Web Service
    client
  • Standard UI provided by ASP.NET(uses
    DefaultWsdlHelpGenerator.aspx)
  • ASP.NET or VB client (add Web Reference or use
    wsdl.exe tool)
  • Internet Explorer WebService behavior
  • Old (COM) clients through SOAP Toolkit 2.0
  • HTTP Post and Get clients

23
Proxies for Web Services
  • Most client implementations use proxies
  • Proxy wraps method calls and serialization of
    generated types (input or return values)

Client Application (ASP.NET or WinForm)
Web Service (any OS or platform)
HTTP Get or Post SOAP
proxy
24
Building a Web Service
  • Implement any class
  • member variables
  • methods
  • Mark any web service method as ltWebMethod()gt
  • Add directive to file lt_at_ WebService
    LanguageVB ClassMyWebService gt
  • Remember
  • Stateless programming paradigm
  • Use public methods only
  • Again, VS.NET uses code-behind and two separate
    files

25
Questions
  • ? ? ?

26
Remoting Web Services, only different
  • Remoting as successor of Distributed COM
  • New remoting boundaries not only machine and
    process, but also AppDomains
  • Remotable objects
  • Inherit from MarshalByRefObject
  • Use a channel (TCP or HTTP) for communication
  • By default HTTP uses a SOAP formatter, TCP a
    more compact binary formatter
  • Configuration through code or configuration file
  • Hosted by daemon app, NT service or IIS
About PowerShow.com