A1256655664CBTFz - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

A1256655664CBTFz

Description:

Find a technology for delivering content through both online and offline channels: ... Scripting interfaces. Questions? Dino Esposito. Artis.Net. desposito ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 31
Provided by: dinoes
Category:

less

Transcript and Presenter's Notes

Title: A1256655664CBTFz


1
  • A Client-Side Environment for ASP Pages
  • Dino Esposito
  • Artis.Net
  • desposito_at_artis.net

2
Topics to be covered
  • Rationale and ASP infrastructure
  • ASP client-side infrastructure
  • Implementation details
  • Globals and business components

3
Goals
  • Find a technology for delivering content through
    both online and offline channels
  • Web sites, portals
  • CD, DVD, mobile devices, local desktop apps

4
Off-the-shelf Choices
  • (Dynamic) HTML
  • Browser dependent
  • Visual Basic
  • Two fairly distinct apps (web, local)
  • ASP
  • Doesn't work without a web server

5
Constraints
  • Identical technology
  • if not identical sources...
  • The only redistributable must be the browser
  • or a browser-like app
  • "Re-use" as many skills as possible
  • The more legacy, the better
  • ASP without IIS or PWS
  • Dual (on/offline) ASP pages

6
ASP Fundamentals
  • Run through an ISAPI extension under the control
    of IIS and MTS/COM
  • The script code is parsed by IIS
  • IIS populates the scripting's namespace with ASP
    intrinsic objects
  • Request, Response, Session and the rest
  • Nothing of the kind on the client
  • Want to get rid of IIS?
  • Need a client-side replacement...

7
Call to Action
  • A specialized browser
  • Detect client-side ASP pages
  • Manage for links and forms
  • Emulator for the ASP object model
  • No support for Session, Application and
    ObjectContext
  • Do what IIS does with ASP pages
  • Extract and process the code blocks
  • Collect all the output and send it to the browser
  • How to process script code?
  • Windows Script interfaces or the Script control

8
Topics to be covered
  • Rationale and ASP infrastructure
  • ASP client-side infrastructure
  • Implementation details
  • Globals and business components

9
The Browser
  • Must detect a local ASP page
  • Treat it in a different manner
  • Invoke a made-to-measure ASP parser
  • Must redirect to local pages when relative URLs
    have been specified
  • Must collect - and pass on to the server -
    information about forms
  • Must prepare the correct (client-side)
    environment for ASP pages

10
The Object Model
  • Any piece of ASP code is processed on the client
    in the environment that the browser (not IIS) set
    up
  • Browser is the IIS client-side counterpart
  • The intrinsic ASP objects must have a client-side
    counterpart
  • The browser is responsible for making objects
    called Response, Request, Session available to
    the scripts

11
Scripting Namespace
IIS
ASPClient
VBS/JS parser
Response Request Server Session Application Object
Context
lt script gt
12
Using the Script Control
  • Implements the Windows Script interfaces
  • Executes script code connecting to the script
    parser
  • Allows you to customize the environment where the
    script executes
  • Scripting namespace
  • Allows you to insert global code
  • Variables, functions

13
Injecting Fake ASP Objects
  • Write objects that mimic the behavior of the ASP
    intrinsic objects
  • Same programming interface
  • Same public name in the scripting namespace
  • Just automation COM objects
  • No matter the language
  • No matter the progID
  • No need for Session and Application
  • Unless for multiuser local environments

14
Topics to be covered
  • Rationale and ASP infrastructure
  • ASP client-side infrastructure
  • Implementation details
  • Globals and business components

15
The Response Object
  • The write method
  • Cannot write a Response object with VB!
  • The internal buffer
  • Like working with ASP buffering always on
  • The methods Clear and End

16
Demo
  • Using the ASPClient browser to open local ASP
    files using the Response object

17
The Request Object
  • Command-line arguments
  • Expose a collection for
  • QueryString
  • Form
  • ServerVariables

C\file.asp?Param1val1Param2val2
18
The QueryString Collection
  • Collects the parameters sent through GET commands
  • IIS fills the collection by examining the HTTP
    command request
  • ASPClient fills the collection by examining the
    command line
  • What about forms?
  • Accessed through name/value pairs

19
Collection vs. Dictionary
  • Collections are a set of values
  • Indexes or keys to access
  • Dictionaries are a set of name/value pairs
  • Associative arrays
  • QueryString is a dictionary
  • In VB, use Scripting.Dictionary instead of the
    native Collection type

20
The Form Collection
  • Collects the parameters sent through POST
    commands
  • IIS fills the collection by examining the HTTP
    command request
  • ASPClient fills the collection by examining the
    command line
  • What about forms?
  • Accessed through name/value pairs

21
Working with ltformgt
  • The browser collects the value of the form's
    elements and sends them to the web server (GET or
    POST)
  • ASPClient does the same but puts the values into
    the QueryString or the Form collection
  • Not exactly what a browser usually does
  • ASPClient must be able to catch the form
    submission
  • With a little help from the DHTML object model

22
Demo
  • Invoke an ASP page with forms and utilize the
    information posted

23
Topics to be covered
  • Rationale and ASP infrastructure
  • ASP client-side infrastructure
  • Implementation details
  • Globals and business components

24
Working with Hyperlinks
  • The browser resolves relative URLs using the
    current location
  • The ASPClient browser defaults to its own folder
  • Needs to redirect to the folder of the current
    ASP page

25
Offline Detection
  • Use the custom ServerVariables collection to let
    apps know when thery're working offline
  • Also consider using the ScriptControl
  • Use offline detection to
  • Switch between (local) Access and (remote) SQL
    Server databases
  • Local registry and remote LDAP server

26
Custom ASP Objects
  • The ScriptControl allows you to define
  • Global variables
  • Global functions
  • They are injected into the global script
    namespace
  • Visible to the global scope
  • An enhanced version of VBScript

27
What About ASP Components?
  • ASP components may early-bind to the ASP type
    library
  • They're needfully bound to the "real" ASP
  • Dual ASP components should accept pointers to
    Response and Request
  • Sacrificing early-binding, makes it possible to
    write components for dual pages

28
Summary
  • A customized browser
  • Client-side ASP parser
  • ScriptControl
  • Automation objects which emulate ASP intrinsic
    objects
  • ASP dual pages

29
References
  • MSDN Magazine
  • Cutting Edge, September 2000
  • "Infrastructure and Implementation of Response"
  • Cutting Edge, October 2000
  • "The Request Object and 3rd Party Components"
  • MSDN Magazine
  • July 1999
  • Script Control
  • Aug-Oct 1997
  • Active Scripting interfaces

30
  • Questions?
  • Dino Esposito
  • Artis.Net
  • desposito_at_artis.net
Write a Comment
User Comments (0)
About PowerShow.com