HTML 5.6

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

ASP is even used to process HTML form’s input, Data entered into a from can be sent to the server .

processed by an ASP and then response sent back to the client .

The following two programs show how to pass/receive information from a HTML form to ASP (.asp) file.

Program 1; Name . html

<html>

<head>

<title>

Hamedsufi presenting ASP ASP with forms

</title>

</head>

<body>

<p> Enter your name ; </p>

<from action = “Name, asp” method = “post”>

<input type = “text” name = “namebox”>

<input type = “submit” name = “submitButton” value = “Enter”>

</form>

</body>

</html>

Program 2; Name.asp

<%@LANGUAGE = VBscript % >

<html>

<head>

<title>

ASP file accepeting Name information

</title>

</head>
<body>

<p> Hi<% = Request (“namebox”)%><br>

]welcome to ASP! </p>

</body>

</html>

Program 1 shows how to pass information from an HTML form to an . asp file using the post method.
The action attribute of the form tag specifies the . asp file to which the form information is posted .
when enter button is

File System Objects (FSOS)provide the programmer the facility to manipulate files , dircctories
and drives and are an essential feature for Active Server Pages that persist data.

FOS’s are objects of Microsoft seripting Runtime Library which includes ; File System Object, File,
Folder, Drive and Textstream as follows;

Object Type Description

File System Object This object allows the programmer to interact with
files, folders and drives.

This object helps the programmer to manipulate


files of any type.

This object helps the programmer to manipulate


directories).

This object helps the programmer to accumulate


information about local or remote drives (Hard-disk
,RAM,etc.)

Text stream object helps the programmer to read and write text files.
(a) The file system object properties and methods are as follows:
Method Description
Copy File his method copies an existing file.
Copyholder This method copies an existing folder.
Create Folder This method creates a folder
CreateTextFile his method creates a text file.
Delete File This method deletes a file
Delete Folder This method deletes a folder
DreveExists This method tests whether a drive exists or not.
File Exists This method tests whether file exists or not
Folder Exists his method tests whether the folder exists or not.
Get Absolute Path Name This method returns the specified drive.
Get Srive This method returns the specified drive
Get File This method returns the drive name.
Get File Name This method returns the required file.
Get Folder This method returns the file name.
Get Parent Folder Name This method returns the parent folder name
GetTempName This method moves a file.
MoveFile This method creates a string representing a file name
Move Folder This method moves a folder.
Open Text File This method opens an existing text file.

(b) The file object properties and methods are as follows:


Propertics Description
DateCreated The date when the file was created
DateLastAccessed The date when the file was last modified
DateLastModified The date when the file was last modified
Drive The drive name where the file is located
Name The file name
Parent Folder This file ‘s parent folder name
Path The file’s path
Short Name The file’s name in short name
Size The size of file in bytes
Methods
Copy This method copies an existing file
Delete This method deletes an existing file
Move This method moves a file
Open As TextStream This method opens an existing file as text as text file

c) The folder object properties and methods are as follows;

Properties Description
Attributes The value indicating folder’s (read only, hidden , etc) attributes

DateCreated The date when the folder was created

Date LastAccessed The date when the folder was last modified

Drive The folder whether a folder is root folder or not

IsRootFolder Describes whether a folder is root folder or not

Name The folder’s name

ParentFolder The folder’s parent folder

RootFolder The Drives’s serial number.

SrialNumber The Drive’s serial number.

TotalSize The total size in bytes of Drive .

VolueName The folder’s path

Short Name The folder’s name as short name

Short Path The folder’s name as short path

Size The total size in bytes of all subfolders and files.

Type The total size in bytes of all subfolders and files.

Type The folder type

Methods

Delete This method deletes the folder

Move This method moves the folder

Copy This method copy an existing folder

d) The drive object properties and methods are as follows;

Property Description

AvailableSpace The amount of space available in bytes on drive .

DriveLetter The type (like “e”) assigned to drive.

DriveType The type (like CDRom ) of drive.


Files System Describes file system 9like FAT32) of drive.

FreeSpace Same as AvailableSpace.

Is Ready Specifies whether drive is ready is ready for use or not.

Path The drive’s path

RootFolder The drive’s root folder

Serial Number The drive’s serial number.

TotalSize The total size in bytes of drive

VolumeName The drive volume name.

5.11

(b) How to Read Cookies Using the Request object

Each time the browser requests a web page. It sends the cookies that the current web site created, and
the serve reads the cookies using the request object as follows;

General Syntax ; Request cookies(“CookieName”) (“Key Name”)

Example

Asp code that reads cookies on server is as follows

<% Request . Cookies(“UserInformation”)(“Name”)%>

© Advanteges and Disadvantage of Using Cookies

The cookies has the following advantages;

(i) As cookies stay on the client ‘s computer, space need not be allocated on the web server to
store user –specific information.
(ii) Cookies can save small amount of information for period of time – weeks . months or even
years!
(iii) Cookies can be used to customize a uservisit a web site.
(i) Clinent’s can choose not accept cookies on their computer.
(ii) Cookies are unable to save large objects, arrays or other complex data types as they can
only save string , date or numberic data types.
5.3.7 Session Tracking by ASP

Session are ASP objects on server designed to save each user’s unique date separately and maintain the
duration of user’s visit. Companies often track the pages that people visit using sessions so that they can
display them for advertisements.

The server performs session traking by keeping track of when a specific person visited a site The first
time a client connecs to the server, the server gives the user a unique session ID . Next time whenever
the client msessin IDs stored in the memory and if a match is found, then it uses it Active server pages
use the of minutes a session exists before it expires (the default value for Time – out property is 20
minutes. ).

The session object’s method Abandon can terminate an individual session.

With cookies, we restried to save only simple data types on the clients computer. But , a session object
can be used to store any type of variable. Event to store arrays. To show this. Create an .. SP page with
the name CreateSession Array . asp follows;

Program; CreateSessionArray.asp

<% @Language = VBScript%>

<%

Dim aSentence(4)

You might also like