Application Object Variables - E-Commerce - Lecture Slides, Slides of Fundamentals of E-Commerce

Students of Communication, study E-Commerce as an auxiliary subject. these are the key points discussed in these Lecture Slides of E-Commerce : Application Object Variables, Active Server Pages, Microsoft Literature, Session Objects, Application Object, Global Variables, Intrinsic, Programmer, Client Requests, Installs

Typology: Slides

2012/2013

Uploaded on 07/29/2013

alok-sarath
alok-sarath 🇮🇳

4.3

(35)

143 documents

1 / 27

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Server-Side Web Programming
with Active Server Pages
ASP Applications
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b

Partial preview of the text

Download Application Object Variables - E-Commerce - Lecture Slides and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

Server-Side Web Programming

with Active Server Pages

ASP Applications

Introduction

•^

In Microsoft literature, an ASP application is oftendefined as one that uses the ASP Applicationand/or Session objects.

-^

ASP applications can consist of three parts:^ –

Application Object

: provides global variables,

constants, objects.

-^

Session Object

: provides variables, constants, and

objects specific to each user's session.

  • Global.asa: Can initiate application and session

variables, constants and objects

ASP Application Object Example^ • In any ASP page:^ Application("TestVar") = "Test Value"^ … • In the same or a different ASP page:^ Response.write Application("TestVar")^ Returns:

"Test Value"

ASP Application Object

•^

An ASP Application object is instantiated the firsttime a client requests

ANY

ASP page in the ASP

application.

-^

IIS installs a default ASP application in the rootdirectory of the server.

-^

Using IIS, separate ASP applications can becreated using the Internet Services Manager.

Application Object Variables

What can be stored in the Application Object?

  • Simple variables (stored as variants!)– Variant type arrays– Variable references to COM objects (e.g., ADO) -^

Common real-life uses:^ – Data caching of small data sets that are commonly used

but don't change often.

  • User counters.– Critical values to all pages.

Application Object Variables

•^

Referencing a non-existent application variablereturns an empty value, not an error (similar toRequest collection)

-^

Avoid repeated calls of same applicationvariable—write to a local variable.

-^

Since all pages/users have access to theapplication object's variables, carefully managewhen/where variables are written.

-^

Use the Application.Lock and Application.Unlockmethods to avoid concurrency problems.

Application Object

•^

Limit your use of application level objects – theytake up server memory that won't be released.

-^

Application-scope variables can be instantiated inany ASP page or by adding code to theApplication_OnStart event of the ASPapplication's global.asa file.

-^

Global.asa file not required to use manyApplication object capabilites.

Application Object Initialization •^

Global.asa file includes an Application_OnEndevent that occurs when the ASP application isunloaded or wthe web service is gracefullystopped.

-^

No guarantee this code will run if web server orthe application crashes.

Global.asa File

•^

You must use IIS to transform a directory into anASP Application if you want to use a separateglobal.asa. Otherwise, application object willdefault to the root global.asa.

Sample Global.asa File

Example

•^

Using the previous global.asa in the

/demo

directory, you would get the result of "MyValue"for

response.write Application("MyVariable")

on

both

/demo1/default.asp

and

/demo1/subdir1/default.asp

-^

If the global.asa in subdir2 is changed to: Application("MyVariable")="NewValue"

, then

/demo1/subdir2/default.asp

would return

"NewValue", but the other pages outside of /demo1/subdir

would still return "MyValue"

ASP Session Object

•^

Each user session is assigned a unique SessionIDvalue that is passed via cookies.

-^

Different SessionIDs are assigned for differentASP applications.

-^

SessionIDs are unique for a single user/applicationsession, but may or may not change betweensessions based upon the client's cookie support.

ASP Session Object

•^

Advantages of sessions:^ – Simplify management of user state information (don't

need to mess with cookies)

  • Above advantage especially useful in an Intranet with

finite users and known browser support.

•^

Disadvantages of sessions include:^ – Resource intensive for server (overhead to track sessions)– Don't scale well for large number of users (memory

needed for each session)

  • Very difficult to scale in server farms.– Sessions don’t scale well on multi-processor machines.

(thread affinity)