Active Server Pages - 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 : Active Server, Web Programming, Pages, Dynamic Web, Static Content, Sophisticated, Dynamically, User Input, Database Content, Personalization

Typology: Slides

2012/2013

Uploaded on 07/29/2013

alok-sarath
alok-sarath 🇮🇳

4.3

(35)

143 documents

1 / 21

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Server-Side Web Programming
with Active Server Pages
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15

Partial preview of the text

Download Active Server Pages - 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 Intrinsic Objects

•^

Request - Exposes what client sent to server.

-^

Response - Collects output back to client.

-^

Application - Represents the ASP page itself.

-^

Session - represents a continuity of connection.

-^

Server - provides services to the application.

-^

ObjectContext - For MTX and transactions.

ASP Request Object

•^

ClientCertificates Collection^ – Values passed from the client's digital certificate. Used

primarily for secure transactions/authentication.

  • Not covered in this class. -^

Cookies Collection^ – Info stored by the server in cookies earlier on the client

are passed back in requests to the server's domain.

  • Covered in a later lecture. -^

Form Collection^ – Values entered into an HTML form are passed to the

server in the HTTP header.

ASP Request Object

•^

QueryString Collection^ – Values appended to a URL^ –

E.g., http://www.barnesandnoble.com/bookstore.asp?userid=22W29R

-^

ServerVariables Collection^ – Somewhat misnamed. Includes the various header values

passed by the client, plus miscellaneous server-relatedvalues.

  • E.g., User agent, Client's IP address, Server name, URL of

current page

  • More later…

HTTP Review

•^

HTTP is the protocol that WWW requests arebased upon.

-^

HTTP specification defines how client requestscontent from a server and how a server returns aresponse to the client.

-^

HTTP supports many request types:^ – PUT

and

DELETE

not commonly used

– GET

and

POST

are primary types.

HTTP Review

•^

GET requests ask server to “get” a resource(indicated by a URL) on the server.

-^

GET request may include additional parametersappended to the URL required by the resource.

-^

POST requests “post” information to a server--typically HTML form variables.

-^

Additional information normally passed by serverto accessory programs (e.g., ASP.dll)

HTTP POST Request

To retrieve the resource at

http://www.host.com/post.asp

Browser sends request to host www.host.com, port 80: POST /post.asp HTTP/1.0From: [email protected]: Mozilla/4.01Content-type: application/x-www-form-urlencodedContent-length:13 [mandatory blank line] name=Jane+Doe The server sends a response back to the client: HTTP/1.0 200 OKDate: Fri, 31 Dec 1999 23:59:59 GMTContent-Type: text/htmlContent-Length: 1354[other header information…]Your name is

Jane Doe

.

GET vs. POST Forms

•^

Browsers default form methods to "GET".

-^

But coders should use "POST" in most cases.^ – Limits on URL length limits value passing

(approximately 2000 characters)

  • POST hides values from users – name/value pairs are

sent in the body of the request instead of URL.

  • More attractive URLs– But be aware that values are not really hidden.

Request.Form Example

Input Page called input.htm: ...

Enter your name:

Output ASP Page called output.asp: ...<%response.write "Your name is " & Request.Form("NAME")%>

Manipulating Request.Form

•^

Can iterate all form field names and values in theRequest.Form collection. Dim

oItem

For

Each oItem in

Request.Form

Response.Write "

"Response.Write "Name:" & oItem & ""Response.Write "Value: " &

Request.Form(oItem) & "

"

Next

Multivalue SELECT Fields

•^

element passing values directly

•^

element passing indirect values

Request.Form & Multivalue Fields^ •

Multivalue form elements output as comma-separated values Response.Write Request.Form(”MYMULTI") Returns

:

1, 2, 3

•^

Or can iterate values in multi-value form elements: for each sItem in Request.Form(”MYMULTI")

Response.Write sItem & "" next Returns

:

1 2 3

Request.Form & Multivalue Fields^ • Count Property:^ Request.Form(”MYMULTI").Count^ • If a field does not have multiple values, count

is 1. If field does not exist, count is 0.

• Use Count property to iterate multivalue fields for i = 1 to Request.Form(”MYMULTI").count

Response.write "Item: " &Request.Form(”MYMULTI")(i) & "" next RETURNS

:

Item: 1Item: 2

Request.Form & Multivalue Fields • Can also treat textboxes as

multivalue fields by giving each box thesame name.

Address1: Address2: RETURNS

:

Address Line 1, Address Line 2