31370683 web technologies
TRANSCRIPT
-
8/12/2019 31370683 Web Technologies
1/93
Lecture Plan
MBA IV Semester -Web Technologies
Lecture 1-9
Definitions
1. A eb broseris a software applicationthat enables a user to display and interact
with text, images, videos, music and other information typically located on a Web pageat
awebsiteon the World Wide Webor a local area network. Text and images on a Webpage can containhyperlinksto other Web pages at the same or different website. Web
browsers allow a user to quickly and easily access information provided on many Web
pages at many websites by traversing these links. Web browsers format T!"
information for display, so the appearance of a Web page may differ between browsers.
#ome of the Web browsers available forpersonal computersinclude $nternet %xplorer,
!o&illa 'irefox, #afari,(pera, and)etscape
*. A Web !ageor eb!ageis a resource of information that is suitable for the World
Wide Weband can be accessed through aweb browser.This information is usually inT!"or +T!"format, and may provide navigationto other web pages via hypertext
links.
Web pages may be retrieved from a local computer or from a remote web server.The
web server may restrict access only to a private network,e.g.a corporate intranet,or itmay publish pages on the World Wide Web. Web pages are requested and served from
web servers using ypertext Transfer rotocol-TT.
Web pages may consist of files of static text stored within theweb server/s file system
-static web pages, or the web server may construct the -+T!" for each web pagewhen it is requested by a browser -dynamic web pages. 0lientside scriptingcan make
web pages more responsive to user input once in the client browser.
A web page is a type of web document.
"# Web site-alternatively, ebsiteor eb site is a collectionof Web pages, images,videos or other digital assets that is hosted on one or several Web server-s, usually
accessible via the $nternet,cell phoneor a"A).
A Web page is a document, typically written in T!", that is almost always accessible
via TT, a protocol that transfers information from the Web serverto display in theuser/s Web browser.
http://en.wikipedia.org/wiki/Application_softwarehttp://en.wikipedia.org/wiki/Application_softwarehttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Websitehttp://en.wikipedia.org/wiki/Websitehttp://en.wikipedia.org/wiki/World_Wide_Webhttp://en.wikipedia.org/wiki/Local_area_networkhttp://en.wikipedia.org/wiki/Hyperlinkhttp://en.wikipedia.org/wiki/Hyperlinkhttp://en.wikipedia.org/wiki/Hyperlinkhttp://en.wikipedia.org/wiki/HTMLhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Internet_Explorerhttp://en.wikipedia.org/wiki/Mozilla_Firefoxhttp://en.wikipedia.org/wiki/Safari_(web_browser)http://en.wikipedia.org/wiki/Safari_(web_browser)http://en.wikipedia.org/wiki/Opera_(web_browser)http://en.wikipedia.org/wiki/Netscape_(web_browser)http://en.wikipedia.org/wiki/World_Wide_Webhttp://en.wikipedia.org/wiki/World_Wide_Webhttp://en.wikipedia.org/wiki/Web_browserhttp://en.wikipedia.org/wiki/Web_browserhttp://en.wikipedia.org/wiki/Web_browserhttp://en.wikipedia.org/wiki/HyperText_Markup_Languagehttp://en.wikipedia.org/wiki/EXtensible_HyperText_Markup_Languagehttp://en.wikipedia.org/wiki/Navigation_barhttp://en.wikipedia.org/wiki/Hypertexthttp://en.wikipedia.org/wiki/Hyperlinkhttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Exempli_gratiahttp://en.wikipedia.org/wiki/Exempli_gratiahttp://en.wikipedia.org/wiki/Intranethttp://en.wikipedia.org/wiki/Intranethttp://en.wikipedia.org/wiki/Hypertext_Transfer_Protocolhttp://en.wikipedia.org/wiki/Hypertext_Transfer_Protocolhttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Static_Web_pagehttp://en.wikipedia.org/wiki/Dynamic_web_pagehttp://en.wikipedia.org/wiki/Client-side_scriptinghttp://en.wikipedia.org/wiki/Web_documenthttp://en.wikipedia.org/wiki/Collectionhttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Internethttp://en.wikipedia.org/wiki/Internethttp://en.wikipedia.org/wiki/Cell_phonehttp://en.wikipedia.org/wiki/LANhttp://en.wikipedia.org/wiki/LANhttp://en.wikipedia.org/wiki/HTMLhttp://en.wikipedia.org/wiki/HTTPhttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Web_browserhttp://en.wikipedia.org/wiki/Application_softwarehttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Websitehttp://en.wikipedia.org/wiki/World_Wide_Webhttp://en.wikipedia.org/wiki/Local_area_networkhttp://en.wikipedia.org/wiki/Hyperlinkhttp://en.wikipedia.org/wiki/HTMLhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Internet_Explorerhttp://en.wikipedia.org/wiki/Mozilla_Firefoxhttp://en.wikipedia.org/wiki/Safari_(web_browser)http://en.wikipedia.org/wiki/Opera_(web_browser)http://en.wikipedia.org/wiki/Netscape_(web_browser)http://en.wikipedia.org/wiki/World_Wide_Webhttp://en.wikipedia.org/wiki/World_Wide_Webhttp://en.wikipedia.org/wiki/Web_browserhttp://en.wikipedia.org/wiki/HyperText_Markup_Languagehttp://en.wikipedia.org/wiki/EXtensible_HyperText_Markup_Languagehttp://en.wikipedia.org/wiki/Navigation_barhttp://en.wikipedia.org/wiki/Hypertexthttp://en.wikipedia.org/wiki/Hyperlinkhttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Exempli_gratiahttp://en.wikipedia.org/wiki/Intranethttp://en.wikipedia.org/wiki/Hypertext_Transfer_Protocolhttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Static_Web_pagehttp://en.wikipedia.org/wiki/Dynamic_web_pagehttp://en.wikipedia.org/wiki/Client-side_scriptinghttp://en.wikipedia.org/wiki/Web_documenthttp://en.wikipedia.org/wiki/Collectionhttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Internethttp://en.wikipedia.org/wiki/Cell_phonehttp://en.wikipedia.org/wiki/LANhttp://en.wikipedia.org/wiki/HTMLhttp://en.wikipedia.org/wiki/HTTPhttp://en.wikipedia.org/wiki/Web_serverhttp://en.wikipedia.org/wiki/Web_browser -
8/12/2019 31370683 Web Technologies
2/93
All publicly accessible websites are seen collectively as constituting the 2World Wide
Web2.
The pages of websites can usually be accessed from a common root 34"called thehomepage,and usually reside on the same physical server. The 34"s of the pages
organi&e them into a hierarchy, although the hyperlinksbetween them control how thereader perceives the overall structure and how the trafficflows betweenthe differentparts of the sites.
#ome websites require a subscriptionto access some or all of their content. %xamples of
subscription sites include manybusinesssites, parts of many newssites, academic 5ournal
sites, gaming sites, message boards,Webbased email, services,social networkingwebsite, and sites providing realtime stock marketdata.
6. $n computing, a !rotocolis a convention or standard that controls or enables theconnection, communication,and datatransfer between two computing endpoints. $n itssimplest form, a protocol can be defined as the rules go$erningthe syntax,semantics,
and synchroni&ation of communication. rotocols may be implemented by hardware,
software, or a combination of the two. At the lowest level, a protocol defines the behavior
of a hardware connection.
7. A computer systemthat is accessed by auserworking at aremotelocation. Typically,
the term is used when there are two computer systems connected by modemsand
telephone lines. The systemthat contains the datais called the host, while thecomputerat
which the user sits is called the remoteterminal.
(* A computer that is connected to a T08$ network, including the $nternet. %ach hosthas a unique $ address.
-9 To provide the infrastructure for a computer service. 'or example, there are manycompanies that host files, programs, applications or even a Web serverfor companies and
individuals. $n the case of a Web server, it means that they provide the hardware,
software,and communications lines required by the server, but the content on the servermay be controlled by someone else.
:. An IP a%%ress-Internet Protocol a%%ress is a unique addressthat certain electronicdevices currently use in order to identify and communicate with each other on a computernetworkutili&ing the $nternet rotocolstandard -IP;in simpler terms, a computer
address. Any participating network device;including routers,switches, computers,
infrastructure servers -e.g.,)T,
-
8/12/2019 31370683 Web Technologies
3/93
=. The Worl% Wi%e Web-commonly shortened to the Web is a system of interlinked,hypertextdocuments accessed via the$nternet. With a web browser, a user views web
pagesthat may contain text,images,videos, and othermultimediaand navigates between
them using hyperlinks.
W&B S&'V&'
The term webservercan mean one of two things:
1. A computer programthat is responsible for accepting TTrequests from clients,
which are known as web browsers, and serving them TT responses along with
optional data contents, which usually are web pages such as T!"documentsand linked ob5ects -images, etc..
*. A computerthat runs a computer program which provides the functionalitydescribed in the first sense of the term.
Although web server programs differ in detail, they all share somebasic common features.
1. (TTP> every web server program operates by accepting TT requests from the
client, and providing an TT response to the client. The TT response usuallyconsists of an T!"document, but can also be a raw file, an image, or some
other type of document -defined by!$!%types? if some error is found in clientrequest or while trying to serve the request, a web server has to send an errorresponse which may include some custom T!" or text messages to better
explain the problem to end users.
*. Logging> usually web servers have also the capability of loggingsome detailedinformation, about client requests and server responses, to log files? this allows
the webmasterto collect statistics by runninglog analy&erson log files.
In practice many web servers implement the following featuresalso:
1. Authentication, optional authori&ationrequest -request of user nameand
password before allowing access to some or all kind of resources.*. andling of not only static content-file content recorded in server/s
filesystem-s but of %)namic contenttoo by supporting one or more relatedinterfaces -##$, 0@$, #0@$, 'ast0@$, #, , A#, A# .)%T, #erver A$
such as)#A$, $#A$, etc..
9. (TTPS support -by ##"or T"# to allow secure -encrypted connections to the
server on the standardport669 instead of usual port BC.
http://en.wikipedia.org/wiki/Hypertexthttp://en.wikipedia.org/wiki/Hypertexthttp://en.wikipedia.org/wiki/Internethttp://en.wikipedia.org/wiki/Internethttp://en.wikipedia.org/wiki/Web_browserhttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Writinghttp://en.wikipedia.org/wiki/Writinghttp://en.wikipedia.org/wiki/Imagehttp://en.wikipedia.org/wiki/Imagehttp://en.wikipedia.org/wiki/Videohttp://en.wikipedia.org/wiki/Multimediahttp://en.wikipedia.org/wiki/Multimediahttp://en.wikipedia.org/wiki/Multimediahttp://en.wikipedia.org/wiki/Hyperlinkhttp://en.wikipedia.org/wiki/World_Wide_Webhttp://en.wikipedia.org/wiki/Server_(computing)http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/HTTPhttp://en.wikipedia.org/wiki/HTTPhttp://en.wikipedia.org/wiki/Web_browserhttp://en.wikipedia.org/wiki/Hypertext_Markup_Languagehttp://en.wikipedia.org/wiki/Hypertext_Markup_Languagehttp://en.wikipedia.org/wiki/Computerhttp://en.wikipedia.org/wiki/HTTPhttp://en.wikipedia.org/wiki/HTMLhttp://en.wikipedia.org/wiki/HTMLhttp://en.wikipedia.org/wiki/MIMEhttp://en.wikipedia.org/wiki/MIMEhttp://en.wikipedia.org/wiki/Data_logginghttp://en.wikipedia.org/wiki/Data_logginghttp://en.wikipedia.org/wiki/Server_loghttp://en.wikipedia.org/wiki/Webmasterhttp://en.wikipedia.org/wiki/Web_log_analysis_softwarehttp://en.wikipedia.org/wiki/Web_log_analysis_softwarehttp://en.wikipedia.org/wiki/Web_log_analysis_softwarehttp://en.wikipedia.org/wiki/Authenticationhttp://en.wikipedia.org/wiki/Authorizationhttp://en.wikipedia.org/wiki/User_namehttp://en.wikipedia.org/wiki/Passwordhttp://en.wikipedia.org/wiki/Filesystemhttp://en.wikipedia.org/wiki/Dynamic_web_contenthttp://en.wikipedia.org/wiki/Dynamic_web_contenthttp://en.wikipedia.org/wiki/Server_Side_Includeshttp://en.wikipedia.org/wiki/Common_Gateway_Interfacehttp://en.wikipedia.org/wiki/SCGIhttp://en.wikipedia.org/wiki/FastCGIhttp://en.wikipedia.org/wiki/JavaServer_Pageshttp://en.wikipedia.org/wiki/PHPhttp://en.wikipedia.org/wiki/Active_Server_Pageshttp://en.wikipedia.org/wiki/ASP.NEThttp://en.wikipedia.org/wiki/Server_Application_Programming_Interfacehttp://en.wikipedia.org/wiki/NSAPIhttp://en.wikipedia.org/wiki/ISAPIhttp://en.wikipedia.org/wiki/Httpshttp://en.wikipedia.org/wiki/Secure_Sockets_Layerhttp://en.wikipedia.org/wiki/Transport_Layer_Securityhttp://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbershttp://en.wikipedia.org/wiki/Hypertexthttp://en.wikipedia.org/wiki/Internethttp://en.wikipedia.org/wiki/Web_browserhttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Web_pagehttp://en.wikipedia.org/wiki/Writinghttp://en.wikipedia.org/wiki/Imagehttp://en.wikipedia.org/wiki/Videohttp://en.wikipedia.org/wiki/Multimediahttp://en.wikipedia.org/wiki/Hyperlinkhttp://en.wikipedia.org/wiki/World_Wide_Webhttp://en.wikipedia.org/wiki/Server_(computing)http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/HTTPhttp://en.wikipedia.org/wiki/Web_browserhttp://en.wikipedia.org/wiki/Hypertext_Markup_Languagehttp://en.wikipedia.org/wiki/Computerhttp://en.wikipedia.org/wiki/HTTPhttp://en.wikipedia.org/wiki/HTMLhttp://en.wikipedia.org/wiki/MIMEhttp://en.wikipedia.org/wiki/Data_logginghttp://en.wikipedia.org/wiki/Data_logginghttp://en.wikipedia.org/wiki/Server_loghttp://en.wikipedia.org/wiki/Webmasterhttp://en.wikipedia.org/wiki/Web_log_analysis_softwarehttp://en.wikipedia.org/wiki/Authenticationhttp://en.wikipedia.org/wiki/Authorizationhttp://en.wikipedia.org/wiki/User_namehttp://en.wikipedia.org/wiki/Passwordhttp://en.wikipedia.org/wiki/Filesystemhttp://en.wikipedia.org/wiki/Dynamic_web_contenthttp://en.wikipedia.org/wiki/Server_Side_Includeshttp://en.wikipedia.org/wiki/Common_Gateway_Interfacehttp://en.wikipedia.org/wiki/SCGIhttp://en.wikipedia.org/wiki/FastCGIhttp://en.wikipedia.org/wiki/JavaServer_Pageshttp://en.wikipedia.org/wiki/PHPhttp://en.wikipedia.org/wiki/Active_Server_Pageshttp://en.wikipedia.org/wiki/ASP.NEThttp://en.wikipedia.org/wiki/Server_Application_Programming_Interfacehttp://en.wikipedia.org/wiki/NSAPIhttp://en.wikipedia.org/wiki/ISAPIhttp://en.wikipedia.org/wiki/Httpshttp://en.wikipedia.org/wiki/Secure_Sockets_Layerhttp://en.wikipedia.org/wiki/Transport_Layer_Securityhttp://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers -
8/12/2019 31370683 Web Technologies
4/93
-
8/12/2019 31370683 Web Technologies
5/93
Introduction to Microsoft IIS
$$# :.C includes new features designed to help businesses, $T professionals, and Webadministrators achieve their goals of performance, reliability, scalability, and security for
potentially thousands of Web sites either on a single $$# server or on multiple servers.This section describes new and notable features in $$# :.C.
4eliability 'eatures>
-
8/12/2019 31370683 Web Technologies
6/93
IIS Applications
An II# Application is a directory, physical or virtual, that has been setup in a manner that ma'es itlogically independent from the rest of the web"site. Its purpose is basically to ma'e sub"directories act
&ust li'e real web"sites, which is very useful on -in /01P Pro, but not really necessary on a #erver. Itsimportant to understand that you cannot create an II# Application simply using *TP or similar tools "" andthis is the cause of many A#P.45T problems.
#o how do you create an II# Application6 *irst, $#.45T automatically ma'es all new web pro&ects into II#Applications, whether you want it to be or not. 7therwise, you need to use II# +anager to create or setupan II# Application, or get your web"host to do it for you (WebHost4Life.comhas a tool for this!. Theeasiest techni8ue is to use II# +anager to create a new $irtual %irectory "" it will also be an II#Application by default, which adds to the confusion.
$n most cases, the content you publish to your Web or 'T site is located in a root or
home directory on your computer, such as 0>I$netpubIWwwrootI. owever, there might
be instances when the content is located somewhere else, or even on a remote computer.
To publish from any directory not contained within your home or root directory, you cancreate a virtual directory. A virtual directory is a directory that is not contained in the
home directory but appears to client browsers as though it were.
Jou can create a virtual directory through $$# !anager or by using Windows %xplorer.
To create a $irtual %irector) b) using IIS Manager
http://www.webhost4life.com/?refid=Wilsonhttp://www.webhost4life.com/?refid=Wilsonhttp://www.webhost4life.com/?refid=Wilson -
8/12/2019 31370683 Web Technologies
7/93
1. $n $$# !anager, expand the local computer, expand the Web Sitesor 0TP Sitesfolder,
rightclick the site or folder within which you want to create the virtual directory, pointto e, and then click Virtual Director). The Virtual Director) *reation Wi2ar%appears.
*. 0lick e3t.
9. $n the Aliasbox, type a name for the virtual directory. -0hoose a short name that is
easy to type because the user types this name.
6. 0lick e3t.
7. $n the Pathbox, type or browse to the physical directory in which the virtual directory
resides, and then click e3t.
:. 3nder Allo the folloing !ermissions, select the check boxes for the accesspermissions you want to assign to your users, and then click e3t#
To start IIS Manager
1. 'rom the Startmenu, point to A%ministrati$e Tools, and then click Internet
Information Ser$ices .IIS/ Manager.
To start IIS Manager from the 'un %ialog bo3
1. 'rom the Startmenu, click 'un.
*. $n the 4!enbox, type inetmgr, and click 45.
Jou can also access $$# from the 0omputer !anagement window. Accessing $$# in thisway does not give you the range of administration options offered by $$# !anager?
however, it does offer quick access and limited management options for your Web sites.
To start IIS Manager from the *om!uter Management in%o
1. 'rom the Startmenu, rightclick M) *om!uter, and click Manage.
*. $n the console tree, expand the Ser$ices an% A!!licationsnode.
9. 0lick Internet Information Ser$ices. The names and states of your Web sites appear
in the details pane.
6. $n the console tree, expand the Internet Information Ser$icesnode and any
subsequent Web site nodes to see a list of directories and virtual directories for thatWeb site.
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/b0c14479-83e3-435d-a935-819fe396e7d2.mspxhttp://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/b0c14479-83e3-435d-a935-819fe396e7d2.mspx -
8/12/2019 31370683 Web Technologies
8/93
-
8/12/2019 31370683 Web Technologies
9/93
has the user left required fields emptyK
has the user entered a valid email addressK
has the user entered a valid dateK
has the user entered text in a numeric fieldK
'e+uire% 0iel%s
The function below checks if a required field has been left empty. $f the required field is
blank, an alert box alerts a message and the function returns false. $f a value is entered,
the function returns true -means that data is (L>
function validateMrequired-field,alerttxt
N
with -field
Nif -valueOOnullPPvalueOO22
Nalert-alerttxt?return falseQ
else Nreturn trueQQ
Q
The entire script, with the T!" form could look something like this>
RhtmlSRheadS
Rscript typeO2text85avascript2S
function validateMrequired-field,alerttxt
Nwith -field
Nif -valueOOnullPPvalueOO22 Nalert-alerttxt?return falseQ
else Nreturn trueQ
QQ
function validateMform-thisform
N
with -thisformN
if -validateMrequired-email,2%mail must be filled out2OOfalse
Nemail.focus-?return falseQQ
Q
R8scriptSR8headS
RbodyS
Rform actionO2submitpage.htm2onsubmitO2return validateMform-this2
-
8/12/2019 31370683 Web Technologies
10/93
methodO2post2S
%mail> Rinput typeO2text2 nameO2email2 si&eO29C2S
Rinput typeO2submit2 valueO2#ubmit2SR8formS
R8bodyS
R8htmlS
&-mail Vali%ation
The function below checks if the content has the general syntax of an email.
This means that the input data must contain at least an U sign and a dot -.. Also, the U
must not be the first character of the email address, and the last dot must at least be one
character after the U sign>
function validateMemail-field,alerttxt
N
with -fieldNaposOvalue.index(f-2U2
dotposOvalue.last$ndex(f-2.2
if -aposR1PPdotposaposR*Nalert-alerttxt?return falseQ
else Nreturn trueQ
QQ
The entire script, with the T!" form could look something like this>
RhtmlS
RheadS
Rscript typeO2text85avascript2S
function validateMemail-field,alerttxtN
with -field
NaposOvalue.index(f-2U2
dotposOvalue.last$ndex(f-2.2
if -aposR1PPdotposaposR*
Nalert-alerttxt?return falseQelse Nreturn trueQ
Q
Qfunction validateMform-thisform
N
with -thisformN
-
8/12/2019 31370683 Web Technologies
11/93
if -validateMemail-email,2)ot a valid email address2OOfalse
Nemail.focus-?return falseQ
QQ
R8scriptS
R8headSRbodyS
Rform actionO2submitpage.htm2
onsubmitO2return validateMform-this?2methodO2post2S
%mail> Rinput typeO2text2 nameO2email2 si&eO29C2S
Rinput typeO2submit2 valueO2#ubmit2S
R8formSR8bodyS
R8htmlS
What is *SS
*SSstands for *ascading Style Sheets
#tyles define ho to %is!la)T!" elements
#tyles are normally stored in St)le Sheets
#tyles were added to T!" 6.C to sol$e a !roblem
&3ternal St)le Sheetscan save you a lot of work
%xternal #tyle #heets are stored in *SS files
*SS S)nta3
S)nta3
The 0## syntax is made up of three parts> a selector, a property and a value>
selector Nproperty> valueQ
The selector is normally the T!" element8tag you wish to define, the property is theattribute you wish to change, and each property can take a value. The property and value
are separated by a colon, and surrounded by curly braces>
body Ncolor> blackQ
ote:$f the value is multiple words, put quotes around the value>
p Nfontfamily> 2sans serif2Q
-
8/12/2019 31370683 Web Technologies
12/93
ote:$f you wish to specify more than one property, you must separate each property
with a semicolon. The example below shows how to define a center aligned paragraph,with a red text color>
p Ntextalign>center?color>redQ
To make the style definitions more readable, you can describe one property on each line,like this>
pN
textalign> center?
color> black?
fontfamily> arialQ
;rou!ing
Jou can group selectors. #eparate each selector with a comma. $n the example below we
have grouped all the header elements. All header elements will be displayed in green text
color>
h1,h*,h9,h6,h7,h:
N
color> green
Q
The class SelectorWith the class selector you can define different styles for the same type of T!"element.
#ay that you would like to have two types of paragraphs in your document> one right
aligned paragraph, and one centeraligned paragraph. ere is how you can do it withstyles>
p.right Ntextalign> rightQ
p.center Ntextalign> centerQ
Jou have to use the class attribute in your T!" document>
Rp classO2right2SThis paragraph will be rightaligned.
R8pS
Rp classO2center2S
This paragraph will be centeraligned.R8pS
-
8/12/2019 31370683 Web Technologies
13/93
ote: To apply more than one class per given element, the syntax is>
Rp classO2center bold2S
This is a paragraph.
R8pS
The paragraph above will be styled by the class 2center2 A)< the class 2bold2.
Jou can also omit the tag name in the selector to define a style that will be used by all
T!" elements that have a certain class. $n the example below, all T!" elements withclassO2center2 will be centeraligned>
.center Ntextalign> centerQ
$n the code below both the h1 element and the p element have classO2center2. This means
that both elements will follow the rules in the 2.center2 selector>
Rh1 classO2center2SThis heading will be centeraligned
R8h1S
Rp classO2center2SThis paragraph will also be centeraligned.
R8pS
A%% St)les to &lements ith Particular Attributes
Jou can also apply styles to T!" elements with particular attributes.The style rule below will match all input elements that has a type attribute with a value of2text2>
$nputEtypeO2text2F Nbackgroundcolor> blueQ
The i% Selector
Jou can also define styles for T!" elements with the id selector. The id selector is
defined as a V.The style rule below will match the element that has an id attribute with a value of
2green2>
Vgreen Ncolor> greenQ
The style rule below will match the p element that has an id with a value of 2para12>
pVpara1N
textalign> center?
color> red
-
8/12/2019 31370683 Web Technologies
14/93
Q
*SS *omments
0omments are used to explain your code, and may help you when you edit the sourcecode at a later date. Drowsers will ignore a comment. A 0## comment begins with 282,and ends with 282, like this>
8 This is a comment 8
p
Ntextalign> center?
8 This is another comment 8
color> black?fontfamily> arial
Q
(o to Insert a St)le Sheet
When a browser reads a style sheet, it will format the document according to it. There arethree ways of inserting a style sheet>
&3ternal St)le Sheet
An external style sheet is ideal when the style is applied to many pages. With an external
style sheet, you can change the look of an entire Web site by changing one file. %ach
page must link to the style sheet using the RlinkS tag. The RlinkS tag goes inside the headsection>
RheadS
Rlink relO2stylesheet2 typeO2text8css2hrefO2mystyle.css2 8S
R8headS
The browser will read the style definitions from the file mystyle.css, and format the
document according to it.
An external style sheet can be written in any text editor. The file should not contain anyhtml tags. Jour style sheet should be saved with a .css extension. An example of a style
sheet file is shown below>
hr Ncolor> siennaQp Nmarginleft> *CpxQ
body Nbackgroundimage> url-2images8back6C.gif2Q
-
8/12/2019 31370683 Web Technologies
15/93
Internal St)le Sheet
An internal style sheet should be used when a single document has a unique style. Jou
define internal styles in the head section by using the RstyleS tag, like this>
RheadSRstyle typeO2text8css2S
hr Ncolor> siennaQp Nmarginleft> *CpxQ
body Nbackgroundimage> url-2images8back6C.gif2Q
R8styleSR8headS
The browser will now read the style definitions, and format the document according to it.
Inline St)les
An inline style loses many of the advantages of style sheets by mixing content withpresentation. 3se this method sparingly, such as when a style is to be applied to a single
occurrence of an element.
To use inline styles you use the style attribute in the relevant tag. The style attribute cancontain any 0## property. The example shows how to change the color and the left
margin of a paragraph>
Rp styleO2color> sienna? marginleft> *Cpx2S
This is a paragraphR8pS
Multi!le St)le Sheets
$f some properties have been set for the same selector in different style sheets, the values
will be inherited from the more specific style sheet.
'or example, an external style sheet has these properties for the h9 selector>
h9
N
color> red?textalign> left?
fontsi&e> Bpt
Q
And an internal style sheet has these properties for the h9 selector>
h9
Ntextalign> right?
-
8/12/2019 31370683 Web Technologies
16/93
fontsi&e> *Cpt
Q
$f the page with the internal style sheet also links to the external style sheet the properties
for h9 will be>
color> red?textalign> right?
fontsi&e> *Cpt
The color is inherited from the external style sheet and the textalignment and the fontsi&e is replaced by the internal style sheet.
Lecture 1- Working with A# ages, A# (b5ects, 'ile #ystem (b5ects,#ession Tracking and 0ookies, Active+
-
8/12/2019 31370683 Web Technologies
17/93
Access any data or databases and return the results to a browser
0ustomi&e a Web page to make it more useful for individual users
The advantages of using A# instead of 0@$ and erl, are those of simplicity and
speed
rovide security since your A# code can not be viewed from the browser
0lever A# programming can minimi&e the network traffic
(o to rite some te3t ith ASP#
A# #ource>
htmlC
bo%)C
res!onse#rite.E(ello Worl%FE/
C
@bo%)C@htmlC
(utput 4esult
(ello Worl%F
ow to format the text with T!" tags.
ASP Source:
RhtmlS
RbodySRX
response.write-2Rh*SJou can use T!" tags to format the textR8h*S2
XSRX
response.write-2Rp styleO/color>VCCCCff/SThis text is styled with the style attribute
R8pS2
XSR8bodyS
R8htmlS
4ut!ut 'esult:Gou can use (TML tags to format the te3tF
This text is styled with the style attribute
The Dasic #yntax 4ule
-
8/12/2019 31370683 Web Technologies
18/93
An A# file normally contains T!" tags, 5ust like an T!" file. owever, an A#
file can also contain ser$er scri!ts, surrounded by the delimiters and C. #erverscripts are e3ecute% on the ser$erH and can contain any expressions, statements,
procedures, or operators valid for the scripting language you prefer to use.
Write 4ut!ut to a Broser
The response.write command is used to write output to a browser. The following examplesends the text 2ello World2 to the browser>
RhtmlS
RbodyS
RX
response.write-2ello World2XS
R8bodyS
R8htmlS
There is also a shorthand method for the response.write command. The followingexample also sends the text 2ello World2 to the browser>
RhtmlS
RbodyS
RXO2ello World2XSR8bodyS
R8htmlS
VBScri!t
Jou can use several scripting languages in A#. owever, the default scripting language
is HD#cript>
RhtmlS
RbodyS
RXresponse.write-2ello World2
XS
R8bodySR8htmlS
The example above writes 2ello World2 into the body of the document.
-
8/12/2019 31370683 Web Technologies
19/93
8a$aScri!t
To set ava#cript as the default scripting language for a particular page you must insert alanguage specification at the top of the page>
RXU languageO25avascript2XS
RhtmlS
RbodyS
RX4esponse.Write-2ello World2
XS
R8bodySR8htmlS
A# Hariables
A $ariable is use% to store information#
If the $ariable is %eclare% outsi%e a !roce%ure it can be change% b) an) scri!t in the
ASP file# If the $ariable is %eclare% insi%e a !roce%ureH it is create% an% %estro)e%
e$er) time the !roce%ure is e3ecute%#
-
8/12/2019 31370683 Web Technologies
20/93
To declare variables accessible to more than one A# file, declare them as session
variables or application variables.
Session Variables
#ession variables are used to store information about ()% single user, and are availableto all pages in one application. Typically information stored in session variables are
name, id, and preferences.
A!!lication Variables
Application variables are also available to all pages in one application. Applicationvariables are used to store information about A"" users in a specific application.
-
8/12/2019 31370683 Web Technologies
21/93
ASP Source:
RhtmlS
RbodySRX
dim ifor iO1 to : response.write-2Rh2 Y i Y 2Seader 2 Y i Y 2R8h2 Y i Y 2S2
next
XSR8bodyS
R8htmlS
4ut!ut 'esult:
(ea%er 1
(ea%er Rinput typeO2text2 nameO2lname2 8SRbr 8SRbr 8S
Rinput typeO2submit2 valueO2#ubmit2 8S
R8formS
3ser input can be retrieved in two ways> With 4equest.Zuery#tring or 4equest.'orm.
'e+uest#Juer)String
The 4equest.Zuery#tring command is used to collect values in a form with
methodO2get2. $nformation sent from a form with the @%T method is visible to everyone-it will be displayed in the browser/s address bar and has limits on the amount of
information to send.
$f a user typed 2Dill2 and 2@ates2 in the form example above, the 34" sent to the server
would look like this>
http>88www.w9schools.com8simpleform.aspKfnameODillYlnameO@ates
Assume that the A# file 2simpleform.asp2 contains the following script>
RbodySWelcome
RXresponse.write-request.querystring-2fname2
response.write-2 2 Y request.querystring-2lname2XS
R8bodyS
The browser will display the following in the body of the document>
Welcome Dill @ates
'e+uest#0orm
The 4equest.'orm command is used to collect values in a form with methodO2post2.
$nformation sent from a form with the (#T method is invisible to others and has nolimits on the amount of information to send.
-
8/12/2019 31370683 Web Technologies
28/93
$f a user typed 2Dill2 and 2@ates2 in the form example above, the 34" sent to the server
would look like this>
http>88www.w9schools.com8simpleform.asp
Assume that the A# file 2simpleform.asp2 contains the following script>
RbodyS
WelcomeRX
response.write-request.form-2fname2
response.write-2 2 Y request.form-2lname2XS
R8bodyS
The browser will display the following in the body of the document>
Welcome Dill @ates
ASP 4b7ectsH 0ile S)stem 4b7ectsH Session Trac>ing an% *oo>ies
ASP *oo>ies
A coo>ie is often use% to i%entif) a user#
&3am!les
Welcome cookie
ow to create a Welcome cookie.
ASP Source:
RX
dim numvisits
response.cookies-2)umHisits2.%xpiresOdate[9:7numvisitsOrequest.cookies-2)umHisits2
if numvisitsO22 then response.cookies-2)umHisits2O1 response.write-2Welcome This is the first time you are visiting this Web page.2
else
response.cookies-2)umHisits2Onumvisits[1 response.write-2Jou have visited this 2
response.write-2Web page 2 Y numvisits
if numvisitsO1 then
-
8/12/2019 31370683 Web Technologies
29/93
response.write 2 time before2
else response.write 2 times before2
end if
end if
XSRhtmlS
RbodyS
R8bodySR8htmlS
4ut!ut 'esult:
Welcome This is the first time you are visiting this Web page.
What is a *oo>ie
A cookie is often used to identify a user. A cookie is a small file that the server embedson the user/s computer. %ach time the same computer requests a page with a browser, it
will send the cookie too. With A#, you can both create and retrieve cookie values.
(o to *reate a *oo>ie
The 24esponse.0ookies2 command is used to create cookies.
ote:The 4esponse.0ookies command must appear D%'(4% the RhtmlS tag.
$n the example below, we will create a cookie named 2firstname2 and assign the value
2Alex2 to it>
RX
4esponse.0ookies-2firstname2O2Alex2
XS
$t is also possible to assign properties to a cookie, like setting a date when the cookieshould expire>
RX
4esponse.0ookies-2firstname2O2Alex2
4esponse.0ookies-2firstname2.%xpiresOV!ay 1C,*CC*VXS
(o to 'etrie$e a *oo>ie Value
The 24equest.0ookies2 command is used to retrieve a cookie value.
-
8/12/2019 31370683 Web Technologies
30/93
$n the example below, we retrieve the value of the cookie named 2firstname2 and display
it on a page>
RXfnameO4equest.0ookies-2firstname2
response.write-2'irstnameO2 Y fnameXS
4ut!ut:
'irstnameOAlex
A *oo>ie ith 5e)s
$f a cookie contains a collection of multiple values, we say that the cookie has Leys.
$n the example below, we will create a cookie collection named 2user2. The 2user2 cookiehas Leys that contains information about a user>
RX
4esponse.0ookies-2user2-2firstname2O2ohn2
4esponse.0ookies-2user2-2lastname2O2#mith2
4esponse.0ookies-2user2-2country2O2)orway24esponse.0ookies-2user2-2age2O2*72
XS
'ea% all *oo>ies
"ook at the following code>
RX
4esponse.0ookies-2firstname2O2Alex24esponse.0ookies-2user2-2firstname2O2ohn2
4esponse.0ookies-2user2-2lastname2O2#mith2
4esponse.0ookies-2user2-2country2O2)orway2
4esponse.0ookies-2user2-2age2O2*72
XS
Assume that your server has sent all the cookies above to a user.
)ow we want to read all the cookies sent to a user. The example below shows how to do
it -note that the code below checks if a cookie has Leys with the asLeys property>
-
8/12/2019 31370683 Web Technologies
31/93
RhtmlS
RbodyS
RXdim x,y
for each x in 4equest.0ookies
response.write-2RpS2 if 4equest.0ookies-x.asLeys then
for each y in 4equest.0ookies-x
response.write-x Y 2>2 Y y Y 2O2 Y 4equest.0ookies-x-y response.write-2Rbr 8S2
next
else
4esponse.Write-x Y 2O2 Y 4equest.0ookies-x Y 2Rbr 8S2 end if
response.write 2R8pS2
next
XSR8bodyS
R8htmlS
4ut!ut:
firstnameOAlex
user>firstnameOohnuser>lastnameO#mith
user>countryO)orwayuser>ageO*7
ASP Session 4b7ect
The Session ob7ect is use% to store information aboutH or change settings for a user
session# Variables store% in the Session ob7ect hol% information about one single
userH an% are a$ailable to all !ages in one a!!lication#
The #ession ob5ect
When you are working with an application, you open it, do some changes and then you
close it. This is much like a #ession. The computer knows who you are. $t knows whenyou start the application and when you end. Dut on the internet there is one problem> the
web server does not know who you are and what you do because the TT address
doesn/t maintain state.
A# solves this problem by creating a unique cookie for each user. The cookie is sent tothe client and it contains information that identifies the user. This interface is called the
#ession ob5ect.
-
8/12/2019 31370683 Web Technologies
32/93
The #ession ob5ect is used to store information about, or change settings for a user
session. Hariables stored in the #ession ob5ect hold information about one single user,and are available to all pages in one application. 0ommon information stored in session
variables are name, id, and preferences. The server creates a new #ession ob5ect for each
new user, and destroys the #ession ob5ect when the session expires.
When %oes a Session Start
A session starts when>
A new user requests an A# file, and the @lobal.asa file includes a
#essionM(n#tart procedure
A value is stored in a #ession variable
A user requests an A# file, and the @lobal.asa file uses the Rob5ectS tag to
instantiate an ob5ect with session scope
When %oes a Session &n%
A session ends if a user has not requested or refreshed a page in the application for aspecified period. Dy default, this is *C minutes.
$f you want to set a timeout interval that is shorter or longer than the default, you can set
the Timeoutproperty.
The example below sets a timeout interval of 7 minutes>
RX#ession.TimeoutO7
XS
To end a session immediately, you may use the Aban%onmethod>
RX
#ession.Abandon
XS
ote:The main problem with sessions is W%) they should end. We do not know if theuser/s last request was the final one or not. #o we do not know how long we should keep
the session 2alive2. Waiting too long for an idle session uses up resources on the server,
but if the session is deleted too soon the user has to start all over again because the serverhas deleted all the information. 'inding the right timeout interval can be difficult
Ti!:$f you are using session variables, store #!A"" amounts of data in them.
-
8/12/2019 31370683 Web Technologies
33/93
Store an% 'etrie$e Session Variables
The most important thing about the #ession ob5ect is that you can store variables in it.
The example below will set the #ession variable usernameto 2
-
8/12/2019 31370683 Web Technologies
34/93
-
8/12/2019 31370683 Web Technologies
35/93
7C
Loo! Through the Static4b7ects *ollection
Jou can loop through the #tatic(b5ects collection, to see the values of all ob5ects storedin the #ession ob5ect>
RX
dim i
'or %ach i in #ession.#tatic(b5ects 4esponse.Write-i Y 2Rbr 8S2
)ext
XS
ASP A!!lication 4b7ect
A grou! of ASP files that or> together to !erform some !ur!ose is calle% an
a!!lication# The A!!lication ob7ect in ASP is use% to tie these files together#
A!!lication 4b7ect
An application on the Web may be a group of A# files. The A# files work together toperform some purpose. The Application ob5ect in A# is used to tie these files together.
The Application ob5ect is used to store and access variables from any page, 5ust like the
#ession ob5ect. The difference is that A"" users share one Application ob5ect, while with
#essions there is one #ession ob5ect for %A0 user.
The Application ob5ect should hold information that will be used by many pages in theapplication -like database connection information. This means that you can access the
information from any page. $t also means that you can change the information in one
place and the changes will automatically be reflected on all pages.
Store an% 'etrie$e A!!lication Variables
Application variables can be accessed and changed by any page in the application.
Jou can create Application variables in [email protected] like this>
Rscript languageO2vbscript2 runatO2server2S
#ub ApplicationM(n#tartapplication-2vartime2O22
application-2users2O1
-
8/12/2019 31370683 Web Technologies
36/93
%nd #ub
R8scriptS
$n the example above we have created two Application variables> 2vartime2 and 2users2.
Jou can access the value of an Application variable like this>
There areRX
4esponse.Write-Application-2users2
XSactive connections.
A# 4esponse (b5ect
The ASP 'es!onse ob7ect is use% to sen% out!ut to the user from the ser$er#
The A# 4esponse ob5ect is used to send output to the user from the server. $t has
collections, properties, and methods.
!ethods like
Metho% Descri!tion
4edirect 4edirects the user to a different 34"
Write Writes a specified string to the output
ASP 'e+uest 4b7ectThe ASP 'e+uest ob7ect is use% to get information from the user#
When a browser asks for a page from a server, it is called a request. The A# 4equest
ob5ect is used to get information from the user. $ts collections, properties, and methods
are described below>
http://www.w3schools.com/asp/met_redirect.asphttp://www.w3schools.com/asp/met_response_write.asphttp://www.w3schools.com/asp/met_redirect.asphttp://www.w3schools.com/asp/met_response_write.asp -
8/12/2019 31370683 Web Technologies
37/93
Juer)String *ollection &3am!les
A# #ource>
htmlC
bo%)C
form actionKE%emore++uer)#as!E metho%KEgetEC
Gour name: in!ut t)!eKEte3tE nameKEfnameE si2eKE
-
8/12/2019 31370683 Web Technologies
38/93
A# #ource
htmlC
bo%)C
form actionKE%emosim!lere++uer)#as!E metho%KEgetEC
0irst name: in!ut t)!eKEte3tE nameKEfnameECbrC
Last name: in!ut t)!eKEte3tE nameKElnameECbrC
in!ut t)!eKEsubmitE $alueKESubmitEC
@formC
'es!onse#Write.'e+uest#Juer)String/
C
@bo%)C
@htmlC
(utput 4esult>
'irst name>
"ast name>
Submit
-
8/12/2019 31370683 Web Technologies
39/93
0orm *ollection &3am!les
This e3am!le %emonstrates ho the 'ormcollection retrie$es the $alues from a
form# The form uses the P4ST metho%H hich means that the information sent is
in$isible to othersH an% it has no limits .)ou can sen% a large amount of information/#
htmlC
bo%)C
form actionKE%emosim!leform1#as!E metho%KE!ostEC
0irst name:
in!ut t)!eKEte3tE nameKEfnameE $alueKEDonal%E @C
br @C
Last name:
in!ut t)!eKEte3tE nameKElnameE $alueKEDuc>E @C
br @C
in!ut t)!eKEsubmitE $alueKESubmitE @C
@formC
'es!onse#Write.'e+uest#0orm/
C
@bo%)C
@htmlC
(utput 4esult>
'irst name>
"ast name>
Submit
-
8/12/2019 31370683 Web Technologies
40/93
fnameKDonal%lnameKDuc>
This e3am!le %emonstrates ho to use the $alues retrie$e% from a form# We use
the 'orm collection# The form uses the !ost metho%#
A# #ource>
htmlC
bo%)C
form actionKE%emosim!leform#as!E metho%KE!ostEC
Gour name: in!ut t)!eKEte3tE nameKEfnameE si2eKE
-
8/12/2019 31370683 Web Technologies
41/93
Metho% Descri!tion
0ontents.4emove
-
8/12/2019 31370683 Web Technologies
42/93
. . .
%nd #ub
R8scriptS
&3am!les
@lobal.asa>Rscript languageO2vbscript2 runatO2server2S
#ub ApplicationM(n%nd-
Application-2totvisitors2OApplication-2visitors2%nd #ub
#ub ApplicationM(n#tart
Application-2visitors2OC
%nd #ub#ub #essionM(n#tart
Application."ock
Application-2visitors2OApplication-2visitors2[1Application.3n"ock
%nd #ub
#ub #essionM(n%ndApplication."ock
Application-2visitors2OApplication-2visitors21
Application.3n"ock%nd #ub
R8scriptS
To display the number of current visitors in an A# file>
RhtmlS
RheadSR8headS
RbodyS
RpSThere are RXresponse.write-Application-2visitors2XS
online now
R8pSR8bodyS
R8htmlS
ASP Session 4b7ect
The Session ob7ect is use% to store information aboutH or change settings for a user
session# Variables store% in the Session ob7ect hol% information about one single
userH an% are a$ailable to all !ages in one a!!lication#
-
8/12/2019 31370683 Web Technologies
43/93
Session 4b7ect
When you are working with an application, you open it, do some changes and then youclose it. This is much like a #ession. The computer knows who you are. $t knows when
you start the application and when you end. Dut on the internet there is one problem> the
web server does not know who you are and what you do because the TT addressdoesn/t maintain state.
A# solves this problem by creating a unique cookie for each user. The cookie is sent to
the client and it contains information that identifies the user. This interface is called the
#ession ob5ect.
The #ession ob5ect is used to store information about, or change settings for a usersession. Hariables stored in the #ession ob5ect hold information about one single user,
and are available to all pages in one application. 0ommon information stored in session
variables are name, id, and preferences. The server creates a new #ession ob5ect for each
new user, and destroys the #ession ob5ect when the session expires.
The #ession ob5ect/s collections, properties, methods, and events are described below>
*ollections
*ollection Descri!tion
0ontents 0ontains all the items appended to the session through a
script command
#tatic(b5ects 0ontains all the ob5ects appended to the session with the
T!" Rob5ectS tag
Pro!erties
Pro!ert) Descri!tion
0odeage #pecifies the character set that will be used when displaying
dynamic content
"0$< #ets or returns an integer that specifies a location or region.0ontents like date, time, and currency will be displayed
according to that location or region
#ession$< 4eturns a unique id for each user. The unique id is generatedby the server
Timeout #ets or returns the timeout period -in minutes for the #essionob5ect in this application
Metho%s
Metho% Descri!tion
http://www.w3schools.com/asp/coll_contents.asphttp://www.w3schools.com/asp/coll_staticobjects.asphttp://www.w3schools.com/asp/prop_codepage.asphttp://www.w3schools.com/asp/prop_lcid.asphttp://www.w3schools.com/asp/prop_sessionid.asphttp://www.w3schools.com/asp/prop_timeout.asphttp://www.w3schools.com/asp/coll_contents.asphttp://www.w3schools.com/asp/coll_staticobjects.asphttp://www.w3schools.com/asp/prop_codepage.asphttp://www.w3schools.com/asp/prop_lcid.asphttp://www.w3schools.com/asp/prop_sessionid.asphttp://www.w3schools.com/asp/prop_timeout.asp -
8/12/2019 31370683 Web Technologies
44/93
Abandon
-
8/12/2019 31370683 Web Technologies
45/93
#ub ApplicationM(n#tart
Application-2visitors2OC
%nd #ub#ub #essionM(n#tart
Application."ock
Application-2visitors2OApplication-2visitors2[1Application.3n"ock
%nd #ub
#ub #essionM(n%ndApplication."ock
Application-2visitors2OApplication-2visitors21
Application.3n"ock
%nd #ubR8scriptS
To display the number of current visitors in an A# file>
RhtmlS
RheadSR8headS
RbodyS
RpSThere are RXresponse.write-Application-2visitors2XS
online now
R8pS
R8bodySR8htmlS
ASP Ser$er 4b7ect
The ASP Ser$er ob7ect is use% to access !ro!erties an% metho%s on the ser$er#
Ser$er 4b7ect
The A# #erver ob5ect is used to access properties and methods on the server. $tsproperties and methods are described below>
Pro!erties
Pro!ert) Descri!tion
#criptTimeout #ets or returns the maximum number of seconds a script can run
before it is terminated
Metho%s
http://www.w3schools.com/asp/prop_scripttimeout.asphttp://www.w3schools.com/asp/prop_scripttimeout.asp -
8/12/2019 31370683 Web Technologies
46/93
Metho% Descri!tion
0reate(b5ect 0reates an instance of an ob5ect
%xecute %xecutes an A# file from inside another A# file
@et"ast%rror- 4eturns an A#%rror ob5ect that describes the error condition thatoccurred
ASP ASP&rror 4b7ect
The A#%rror ob5ect is used to display detailed information of any error that occurs in
scripts in an A# page.
The ASP&rror 4b7ect
The A#%rror ob5ect was implemented in A# 9.C and is available in $$#7 and later.
The A#%rror ob5ect is used to display detailed information of any error that occurs inscripts in an A# page. The A#%rror ob5ect is created when #erver.@et"ast%rror is
called, so the error information can only be accessed by using the #erver.@et"ast%rror
method.
ASP 0ileS)stem4b7ect 4b7ect
The 0ileS)stem4b7ect ob7ect is use% to access the file s)stem on the ser$er#
The 0ileS)stem4b7ect 4b7ect
The 'ile#ystem(b5ect ob5ect is used to access the file system on the server. This ob5ect
can manipulate files, folders, and directory paths. $t is also possible to retrieve file system
information with this ob5ect.
The following code creates a text file -c>Itest.txt and then writes some text to the file>
RXdim fs,fname
set fsO#erver.0reate(b5ect-2#cripting.'ile#ystem(b5ect2
set fnameOfs.0reateText'ile-2c>Itest.txt2,truefname.Write"ine-2ello World2
fname.0loseset fnameOnothing
set fsOnothingXS
http://www.w3schools.com/asp/met_server_createobject.asphttp://www.w3schools.com/asp/met_execute.asphttp://www.w3schools.com/asp/met_getlasterror.asphttp://www.w3schools.com/asp/met_server_createobject.asphttp://www.w3schools.com/asp/met_execute.asphttp://www.w3schools.com/asp/met_getlasterror.asp -
8/12/2019 31370683 Web Technologies
47/93
Acti$eN Data 4b7ectsH Accessing a Database from Acti$e Ser$er Page#
AD4 can be use% to access %atabases from )our eb !ages#
Accessing a Database from an ASP Page
The common way to access a database from inside an A# page is to>
1. 0reate an A
-
8/12/2019 31370683 Web Technologies
48/93
*reate an 4DB* Database *onnection
$f you have an (
RX
set connO#erver.0reate(b5ect-2A
-
8/12/2019 31370683 Web Technologies
49/93
connection string via a 0ommand or 4ecordset ob5ect. owever, this type of connection
is only good for one specific, single query.
ProgID
set ob50onnectionO#erver.0reate(b5ect-2A
RX
set connO#erver.0reate(b5ect-2A
-
8/12/2019 31370683 Web Technologies
50/93
#uppose we have a database named 2)orthwind2, we can get access to the 20ustomers2
table inside the database with the following lines>
RXset connO#erver.0reate(b5ect-2A
-
8/12/2019 31370683 Web Technologies
51/93
next
4esponse.Write-2Rbr 8S2
rs.!ove)extloop
rs.close
conn.closeXS
R8bodyS
R8htmlS
ere is the result>
0ustomer$< O A"'L$
0ompany)ame O Alfreds 'utterkiste0ontact)ame O !aria Anders
0ontactTitle O #ales 4epresentative
Address O (bere #tr. 7=0ity O Derlin
ostal0ode O 1**C\
0ountry O @ermany
0ustomer$< O D%4@#0ompany)ame O Derglunds snabbk]p
0ontact)ame O 0hristina Derglund
0ontactTitle O (rder AdministratorAddress O Derguvsv^gen B
0ity O "ule_
ostal0ode O #\7B **0ountry O #weden
0ustomer$< O 0%)T0
0ompany)ame O 0entro comercial !octe&uma
0ontact)ame O 'rancisco 0hang0ontactTitle O !arketing !anager
Address O #ierras de @ranada \\\9
0ity O !`xico
-
8/12/2019 31370683 Web Technologies
52/93
Dis!la) the 0iel% ames an% 0iel% Values in an (TML Table
We can also display the data from the 20ustomers2 table inside an T!" table with thefollowing lines -remember to save the file with an .asp extension>
RhtmlS
RbodyS
RX
set connO#erver.0reate(b5ect-2A
-
8/12/2019 31370683 Web Technologies
53/93
RX
set connO#erver.0reate(b5ect-2A
*om!an)name *ontactname
Alfreds 'utterkiste !aria Anders
Derglunds snabbk]p 0hristina Derglund
0entro comercial !octe&uma 'rancisco 0hang
AD4 JueriesWe ma) use SJL to create +ueries to s!ecif) onl) a selecte% set of recor%s an% fiel%s
to $ie#
-
8/12/2019 31370683 Web Technologies
54/93
Dis!la) Selecte% Data
We want to display only the records from the 20ustomers2 table that have a20ompanyname2 that starts with an A -remember to save the file with an .asp extension>
RhtmlS
RbodyS
RX
set connO#erver.0reate(b5ect-2A
*om!an)name *ontactname
Alfreds 'utterkiste !aria Anders
-
8/12/2019 31370683 Web Technologies
55/93
-
8/12/2019 31370683 Web Technologies
56/93
"et the user choose filter
"et the user choose which country to show customers from.
ASP Source:
RhtmlS
RbodyS
RX
set connO#erver.0reate(b5ect-2A
-
8/12/2019 31370683 Web Technologies
57/93
RthS0ompanynameR8thS
RthS0ontactnameR8thS RthS0ountryR8thS
R8trS
RX
do until rs.%(' response.write-2RtrS2
response.write-2RtdS2 Y rs.fields-2companyname2 Y 2R8tdS2
response.write-2RtdS2 Y rs.fields-2contactname2 Y 2R8tdS2 response.write-2RtdS2 Y rs.fields-2country2 Y 2R8tdS2
response.write-2R8trS2
rs.!ove)extloop
rs.close
conn.0loseset rsO)othing
set connO)othingXSR8tableS
RX end if XS
R8bodyS
R8htmlS
4ut!ut 'esult:
0hoose 0ountryShow customers
D4 A%% 'ecor%s
We ma) use the SJL IS&'T IT4 comman% to a%% a recor% to a table in a
%atabase#
A%% a 'ecor% to a Table in a Database
We want to add a new record to the 0ustomers table in the )orthwind database. We firstcreate a form that contains the fields we want to collect data from>
RhtmlS
RbodyS
Rform methodO2post2 actionO2demoMadd.asp2S
RtableSRtrS
RtdS0ustomer$R8tdS
RtdSRinput nameO2custid2SR8tdSR8trSRtrS
-
8/12/2019 31370683 Web Technologies
58/93
RtdS0ompany )ame>R8tdS
RtdSRinput nameO2compname2SR8tdS
R8trSRtrSRtdS0ontact )ame>R8tdS
RtdSRinput nameO2contname2SR8tdS
R8trSRtrSRtdSAddress>R8tdS
RtdSRinput nameO2address2SR8tdS
R8trSRtrSRtdS0ity>R8tdS
RtdSRinput nameO2city2SR8tdS
R8trSRtrS
RtdSostal 0ode>R8tdSRtdSRinput nameO2postcode2SR8tdS
R8trSRtrS
RtdS0ountry>R8tdS
RtdSRinput nameO2country2SR8tdSR8trS
R8tableSRbr 8SRbr 8S
Rinput typeO2submit2 valueO2Add )ew2S
Rinput typeO2reset2 valueO20ancel2S
R8formSR8bodyS
R8htmlS
When the user presses the submit button the form is sent to a file called 2demoMadd.asp2.
The 2demoMadd.asp2 file contains the code that will add a new record to the 0ustomerstable>
RhtmlS
RbodyS
RXset connO#erver.0reate(b5ect-2A
-
8/12/2019 31370683 Web Technologies
59/93
on error resume next
conn.%xecute sql,recaffected
if errRSC then 4esponse.Write-2)o update permissions2
else
4esponse.Write-2Rh9S2 Y recaffected Y 2 record addedR8h9S2end if
conn.close
XS
R8bodyS
R8htmlS
Im!ortant
$f you use the #Z" $)#%4T command be aware of the following>
$f the table contains a primary key, make sure to append a unique, non)ull valueto the primary key field -if not, the provider may not append the record, or an
error occurs
$f the table contains an Auto)umber field, do not include this field in the #Z"$)#%4T command -the value of this field will be taken care of automatically by
the provider
What about 0iel%s With no Data
$n a !# Access database, you can enter &erolength strings -22 in Text, yperlink, and
!emo fields $' you set the Allowero"ength property to Jes.
ote:)ot all databases support &erolength strings and may cause an error when a record
with blank fields is added. $t is important to check what data types your databasesupports.
AD4 !%ate 'ecor%s
We ma) use the SJL PDAT& comman% to u!%ate a recor% in a table in a
%atabase#
-
8/12/2019 31370683 Web Technologies
60/93
!%ate a 'ecor% in a Table
We want to update a record in the 0ustomers table in the )orthwind database. We firstcreate a table that lists all records in the 0ustomers table>
RhtmlS
RbodyS
RX
set connO#erver.0reate(b5ect-2A
-
8/12/2019 31370683 Web Technologies
61/93
-
8/12/2019 31370683 Web Technologies
62/93
response.write-24ecord 2 Y cid Y 2 was updated2
end if
end ifconn.close
XS
R8bodySR8htmlS
AD4 Delete 'ecor%s
We ma) use the SJL D&L&T& comman% to %elete a recor% in a table in a
%atabase#
Delete a 'ecor% in a Table
We want to delete a record in the 0ustomers table in the )orthwind database. We firstcreate a table that lists all records in the 0ustomers table>
RhtmlS
RbodySRX
set connO#erver.0reate(b5ect-2A
-
8/12/2019 31370683 Web Technologies
63/93
RXelseXS
RtdSRX4esponse.Write-x.valueXSR8tdS
RXend ifnext
XS
R8formSRXrs.!ove)extXS
R8trS
RXloop
conn.close
XS
R8tableSR8bodyS
R8htmlS
$f the user clicks on the button in the 2customer$
-
8/12/2019 31370683 Web Technologies
64/93
else
sqlO267>6= A!
17 an 4efsnes :: == BB 5aniUw9schools.com http>8www.w9schools.com
=8118*CCC
1>C1>7: !
39 Torleif 4asmussen == BB \\ )8A )8A68*:8*CCC9>6:>61 A!
46 anton chek B9B99 apaUkabar.com www.yahoo.com
68*78*CCC
=>1=>67 A!
48 stale refsnes777
1**96refsnesUhotmail.com http>88www.w9schools.com
78918*CCC
11>16>99 A!
-
8/12/2019 31370683 Web Technologies
65/93
52 hari prawin\B61C
\7B\=hariUhari.com www.hari.com
181B8*CC1
=>6=>7B A!
53 ege 4efsnes )8A hegeUsomewhere.com )8A
98**8*CC1
1>97>C1 !
Hiew source on how to list a database table in an T!" table
RXoption explicitXSRhtmlS
RheadSRtitleSA
-
8/12/2019 31370683 Web Technologies
66/93
R8formS
RXrs.!ove)extXSR8trS
RX
loop
rs.closeset rsOnothing
conn.close
set connOnothingXS
R8tableS
RpSRa hrefO2showcode.aspKsourceOdemoMdbMlist.asp2SHiew source on how to list a
database table in an T!" tableR8aSR8pS
RpSRbS)ote>R8bS $f you click on a button in the 2no2 column a new page will open. (nthe new page you may look at the source on how to create input fields based on the fields
from one record in the database table.R8pSR8bodyS
R8htmlS
&%it Database Table
fname
lname
phone
emailhomepage
Save Delete
Hiew source on how to create input fields based on the fields from one record in the
database table.
ote:$f you click on 2#ave2 or 2
-
8/12/2019 31370683 Web Technologies
67/93
rs.(pen 2#elect from tbl@uestDook where [email protected] Y no , conn
XSRhtmlS
RheadS
RtitleSA
-
8/12/2019 31370683 Web Technologies
68/93
-
8/12/2019 31370683 Web Technologies
69/93
you may look at the source on how to add a record to a database table.R8pS
R8bodySR8htmlS
Lecture
-
8/12/2019 31370683 Web Technologies
70/93
The Internet has come a long way since the old A9PA45T days.7riginally designed for research use by the %epartment of %efense,the Internet has become a haven for millions of people who havee)perienced the value of communicating with people around the world.Internet users have instant access to a plethora of 'nowledge
supported by this networ' of networ's.
+ost people point to >??> as the beginning of the Internet e)plosion.In the late >?@2s, the academic community began to see the Internetas a valuable tool. Professors and students at universities around theworld began using the Internet as a way to gain valuable research and'nowledge about myriad sub&ects. #ervices such as electronic mail (e"mail!, file transfer capability (ftp!, and newsgroup discussions allcontributed to the growth of the Internet audience. Then, in >??>, the4ational #cience *oundation (4#*!, which was the ma&or fundinggroup for the Internet, dropped most of its financial support andallowed commercial traffic onto the Internet. The door was now openfor all types of individuals and businesses to ta'e advantage of thisvital communication networ'.
-e are truly living in the Information Age, and the Internet hasbecome the primary means for e)panding our hori=ons. The Internethas opened up any number of possibilities for applications by providinga ready"made networ' for businesses to use. rowth in the Internethas also forced us to rethin' the way we approach life. A student in;alifornia can communicate with his parents in *lorida via e"mail
instead of building up a hefty, long distance telephone bill. In fact, nowmost families can conduct conversations over the Internet, therebys'irting the phone companies.
-ith the growth of the ---, businesses have been scrambling togain a presence on the Internet. In >??B, corporate spending onInternet0intranet systems was C> billion. This figure is e)pected togrow to C2@ billion by the year 222. %evelopers will play a huge rolein helping organi=ations and businesses understand the importance ofusing the Internet from an application and communication standpoint.
The 'ise in Intranets
+any companies are reali=ing the benefits of the Internet from withintheir companies. These organi=ations are creating intranets, which areprivate, or internal, internets. These intranets have been establishedinitially as an internal communication tool. 5mployees can send e"mailto other employees within the company. Intranets enable private and
-
8/12/2019 31370683 Web Technologies
71/93
-
8/12/2019 31370683 Web Technologies
72/93
architecture model while providing the internal infrastructure toguarantee response time and security.
Intranet applications also are cost effective from an administration anddeployment standpoint. The browser serves as the universal client for
all des'tops. The server ma'es the des'top come alive by providinginformation and database access. %eployment and administration costsare reduced, because you dont have to reinstall an updatedapplication on everyones des'tops as you do when creatingproprietary client"server applications. 5lectronic commerce is going todrastically grow in the ne)t few years and with it will come a continuedrise in the use of intranets.
This section has described intranets as being internal to anorgani=ation or business. Private intranets that focus on providing areliable and secure infrastructure for groups of businesses also areemerging. Technology companies are beginning to prepare for thisoccurrence. +icrosoft formed an alliance with ritishTelecommunications and +;I to provide private data networ's forglobal companies and their customers.
Private intranets offer the same reliability, security, and guaranteedresponse time that a companys internal intranet provides. Thedifference between them is that a companys reach e)tends beyondthe internal organi=ation to e)ternal entities. The use of privateintranets will continue to rise as application re8uirements e)ceed the
current capabilities of the Internet infrastructure.
The bi+uitous Web
The second e)plosion that propelled the Internet into nationalprominence was the creation of the -orld -ide -eb. The -eb hasmany origins, but most people point to the time period between >?@?">??> when the ;onseil 5uropean pour la 9echerche 4ucleaire (;594!5uropean Daboratory for Particle Physics in eneva, #wit=erland,developed its first specifications. Tim erners"Dee, a researcher for
;594, developed the basic concepts of sharing information throughthe use of a consistent, universal interface. +ar' Andreessen iscredited with developing the first browser (+osaic! for the -eb in>??3. The use of a browser to view the Internet turned attention awayfrom the information stored on the server, focusing more on the usere)perience through the client machine. The browser provided agraphical, point"and"clic' interface for viewing -eb content that madethe Internet easier to access.
-
8/12/2019 31370683 Web Technologies
73/93
The -eb is the primary service responsible for bringing the Internetinto the homes of millions. The -eb is the most popular and useableservice. The hyperte)t lin's to a plethora of information allow the userto e)perience a web of 'nowledge. The user can choose the learningpath instead of following a se8uential or linear pattern.
The most recent numbers estimate that more than EB million peoplehave visited the -eb at least once. -hen sports figures, musiccelebrities, and news anchors are touting the -eb, you 'now it hasbecome ubi8uitous. The -eb provides an alternate delivery channel forall types of information as well as graphically robust applications.+a&or software vendors are totally revamping their products to ma'ethem Internet"enabled. an's are having to rethin' their strategy oftargeting and servicing their customers by providing online ban'ing.usinesses are establishing a presence on the -eb to offer productsand services electronically. The -eb is everywhere, and we must learnhow to properly and constructively use its capabilities.
The first wave of -eb development involved information publishing.9udimentary tools were provided to convert documents created withcommon word processors to the HT+D format of the -eb. HT+Deditors also have provided a way to create original documents as wellas -eb pages and deploy them on the -eb. As stated, the Internetand the -eb have saved a lot of money for companies in terms ofprinting, processing, and mailing costs. The -eb has e)tended thenotion of te)tual documentation to provide graphical information as
well. raphics, 3% images, audio, and video can truly enhance theusers e)perience on the -eb. ;ompanies li'e +acromedia and9ealAudio have contributed to the multimedia e)perience by providingenhanced and animated graphics and audio capability. The 5#P45T#portsFone is one of the most popular sites on the -eb largely due tothe way the site employs multimedia. ou can download 5#P4commercials both in audio and video format as well as listen to pressconferences and other sporting events. This site does owe some creditto the popularity of 5#P4, but the people would not be visiting the siteif it didnt provide a rich and rewarding e)perience.
The second wave of -eb development has been the creation offunctional applications. These applications e)tend the simpleregistration forms commonly seen on -eb sites to become trueinteractive applications that include database accessibility. Theseapplications can be classified as &ust another phase of client"server.
-
8/12/2019 31370683 Web Technologies
74/93
In ta'ing a loo' at the architecture of the -eb, many of the principleshave been carried over from client"server architectures. *igure >.illustrates a typical client"server architecture.
!igure ".#.
A typical client-server architecture.
;lient"server is a style of computing where the client machine ma'es are8uest of a server machine. The re8uest is usually a re8uest forinformation, as in a database re8uest, or for processing, such asupdating a database or running a batch process. The client machinema'es the re8uest, and the server machine fulfills this re8uest. Thebenefit of client"server systems is that they ta'e advantage of thestrengths of each machine or platform. In a typical scenario, the clienthandles some application logic and the presentation to the user whilethe server provides the bac'"end processing and database functions.
In a typical -eb application, the browser serves as the universal clientthat sends a re8uest for a web page, interprets the HT+D document,and displays it to the user. The web server receives the re8uestthrough the HyperTe)t Transport Protocol (HTTP! and returns there8uired information in HT+D format that the client can understand.#imilar to client"server, you can distribute the application processingand database management portions to varying degrees between theclient and the server machine. *igure >.3 depicts a typical -eb"based
architecture.
!igure ".$.
A typical Web-based architecture.
The main benefit to -eb"based applications over client"server is foundin the deployment. In a -eb"based scenario, you dont have to deploya new e)ecutable on each persons des'top with each new applicationfeature or update. The browser serves as the universal client,providing access to the most current information on the server.
$ersion control, software distribution, and systems management costsare significantly reduced for -eb"based applications.
A more in"depth discussion concerning how the web client and serverinteract is warranted here. Historically, -eb applications have beenbased on HT+D and common gateway interface (;I! programs on theserver. The -eb browser interprets the HT+D tags and appropriately
http://www.emu.edu.tr/english/facilitiesservices/computercenter/bookslib/Teach%20Yourself%20Microsoft%20Visual%20InterDev%20In%2021%20Days/art/ch01/01tis02.gifhttp://www.emu.edu.tr/english/facilitiesservices/computercenter/bookslib/Teach%20Yourself%20Microsoft%20Visual%20InterDev%20In%2021%20Days/art/ch01/01tis03.gifhttp://www.emu.edu.tr/english/facilitiesservices/computercenter/bookslib/Teach%20Yourself%20Microsoft%20Visual%20InterDev%20In%2021%20Days/art/ch01/01tis02.gifhttp://www.emu.edu.tr/english/facilitiesservices/computercenter/bookslib/Teach%20Yourself%20Microsoft%20Visual%20InterDev%20In%2021%20Days/art/ch01/01tis03.gif -
8/12/2019 31370683 Web Technologies
75/93
formats the page for the user. A web page can be a combination offormatted te)t, images and graphics, audio, and video. HT+D alsoallows for the creation of basic forms that contain te)t fields, radiobuttons, chec'bo)es, push buttons, and listbo)es. These ob&ects arediscussed in more detail on %ay >, Gsing asic and Advanced HT+D
*orm ;ontrols.
;I programs have typically been used for processing re8uests on theserver and distributing information to the client machine. ;Iprograms, or scripts, are e)ecutable files that can be built usinglanguages such as G4I1 shell script, Perl, ;, and so on. As informationis updated on your database, the ;I script can handle accessing thedata and passing the information bac' down to the client browser. Theadvantage is that you dont have to write new HT+D code for everynew document or database update. The ;I server program providesa reusable component that saves development time.
I mentioned the HTTP protocol earlier in this chapter. HTTP is theprotocol that allows the browser to connect to a web server. HTTP is astateless protocol that is, the client and server dont maintain apersistent connection. The client ma'es a connection to the server andsends a re8uest. The server receives the re8uest, processes it, thenterminates the connection. This process is repeated many times duringa user session. This 'ind of communication would be li'e having atelephone conversation with a friend where you would say something,hang up the telephone, then dial again to say something else. This
dialogue is very tedious. Interactive applications must have some wayto maintain state with the user machine in order to provide for theneeds of applications li'e sales order processing.
+icrosoft and 4etscape have led the charge to develop an effectiveserver process that supports a more interactive state with the clientmachine. The creation of application programming interfaces, or APIs,has opened up all 'inds of possibilities over the traditional use of ;Iprograms. There are several specific benefits to using APIs. *irst, APIsare more efficient than ;I programs. A ;I program opens up aprocess in memory for each client re8uest. APIs e)ecute processes inthe same memory address space, eliminating the overhead of separatee)ecuting processes on one machine. y using this model, APIs useless memory for e)ecuting a process. Also, initiali=ation with the clientmachine is performed once for all re8uests. Another benefit of APIs istheir ability to maintain state. API programs permit a persistentconnection between the client and server, which can be a huge benefitwhen developing an application with moderate to intensive database
-
8/12/2019 31370683 Web Technologies
76/93
connectivity. Also, separate re8uests can share information about theclient, because the programs remain resident in memory.
The main disadvantage to APIs is that theyre proprietary in nature.-hereas ;I programs are server"independent, APIs are confined to
their respective web server platforms. Table >.> presents the mostcommon APIs and their supported server platforms.
Table 1#1# The most !o!ular APIsH their res!ecti$e $en%orsH an% su!!orte% ser$er
!latforms#
API Ven%or Ser$er Platform Su!!orte%
$#A$ !icrosoft!icrosoft $nternet $nformation #erver, rocess #oftware
urveyor Web#erver
)#A$ )etscape )etscape 0ommerce80ommunication #erver
W#A$(/4eilly Y
Associates (/4eilly Y Associates Web#ite
To summari=e, the -eb has become popular for a variety of reasons.The -eb provides graphically rich content on a variety of topics tomany users. The -eb also supports transaction"based services thatenable businesses and consumers to come together in an electronicmar'et. 5)amples include ordering boo's, ma'ing airline reservations,and trading stoc's. Dearning is also significantly enhanced by havingaccess to all 'inds of documents, white papers, and training materials.4ame the sub&ect, and you can become an e)pert on it in no time at
all by accessing the -eb.
The Difference Beteen Static an% D)namic Web Pages
-eb"based applications have made the transition from solelypublishing information to creating an interactive session with the user.#tatic web pages represent those pages that provide information thatis nicely formatted in standard HT+D. *or e)ample, a person might beable to re8uest an employee benefit handboo' to become familiar withthe latest updates in benefits. #tatic pages are nice, but users want
something more.
%ynamic web pages are those pages that provide true user interaction.In this model, users interact through the use of server"side programsthat provide for an enhanced e)perience. Instead of &ust reading aboutthe latest human resource benefits, employees can register andupdate their benefits. %ynamic web pages support the building of trueinteractive applications. 7nce you have read the published flight
-
8/12/2019 31370683 Web Technologies
77/93
schedules, you can ma'e airline reservations electronically over theInternet. #toc' bro'erage houses can publish the hottest stoc' tipsand then enable you to capitali=e on the investment through onlinestoc' trading. %ynamic web pages provide a world of new possibilitiesover static pages.
I briefly discussed the use of ;I and API programs in providing agateway between your client and server machine in a -eb"basedapplication. Here, I will focus on the ability to use client" and server"side scripts to create dynamic HT+D web pages.
;lient"side script is usually associated with ob&ects on the HT+D page.These ob&ects could be standard HT+D controls or Active1 controls.;lient"side script is usually included to ma'e up for the limitedfunctionality of HT+D. The script is included in the HT+D page when itis downloaded from the server to the client machine. The script codee)ecutes on the client machine in response to user interaction andprogram events. y 'eeping the script in the HT+D page on the server,a developer only has to ma'e changes to centrali=ed code located onthe server. The browser downloads the revised web page simplifyingthe software distribution process. The goal in this model is to 'eep thecode resident on the server leaving little or no code on the clientmachine. #ome e)amples for using client"side script include userinterface functions, entry verification, and standard programmingfunctions.
Two of the most popular scripting languages are 4etscapes ava#criptand +icrosofts $#cript. $isual Inter%ev supports both of thesescripting engines, although +icrosoft has implemented its own versionof 4etscapes ava#cript called #cript. There are no significantdifferences between the #cript and ava#cript implementation.
Another way to create a dynamic e)perience is through the use ofActive1 controls and ava applets. $isual Inter%ev includes andsupports the use of both Active1 controls and ava applets within yourapplication. These controls provide many additional functions frommultimedia to database connectivity. oth ava#cript and $#cript areused to interact with these controls e)tending the reach of theinterface. #imilar to the use of $isual asic code with $isual asiccontrols, $#cript and ava#cript serve as the glue between thebrowser and the particular control. The process is essentially the sameas using a traditional client"server tool li'e $isual asic. ou add acontrol to your page, setting its methods and properties. 7nce youhave established the basic properties, you add scripting code to handle
-
8/12/2019 31370683 Web Technologies
78/93
-
8/12/2019 31370683 Web Technologies
79/93
integrated development environment to build their applications. -hy,you as', do you need an integrated tool6 Ta'e a wal' through a typical-eb development effort and loo' at the many different types of toolsthat you can use to build a -eb"based application.
*irst you need an HT+D editor. +any people have created a newfunction for an old product and made 4otepad the HT+D editor ofchoice. Table >. outlines some of the more robust and popularproducts on the mar'et.
Table 1#
-
8/12/2019 31370683 Web Technologies
80/93
environment will be needed to support your ava development.+icrosofts $isual
-
8/12/2019 31370683 Web Technologies
81/93
comprehensive tools to create and maintain a web site into $isualInter%ev.
Integrated Development %nvironment
$isual Inter%ev provides a robust, integrated developmentenvironment to address the many capabilities of the -eb. ou canintegrate various technologies, li'e Active1 controls and Active #erver;omponents, to create a powerful application. The integrateddevelopment environment enables you to use scripting languages li'e$#cript and ava#cript to create dynamic applications and -ebpages. ou can wor' on simultaneous pro&ects of different types allfrom within $isual Inter%evs %eveloper #tudio interface. In addition to$isual Inter%ev pro&ects, you also can develop $isual ;
-
8/12/2019 31370683 Web Technologies
82/93
specific actions with associated Active1 control events. y lin'ing theseevents and actions, the #cript -i=ard generates all of the necessaryscript language for you. 7nce the language is generated, you have theability to modify and add to the code. This process can save youconsiderable development time by generating the routine script and
enabling you to focus on the more advanced code for your application.
$isual Inter%ev also includes two tools for spicing up your web pages.These tools focus on multimedia creation and management. The+icrosoft Image ;omposer and +icrosoft +usic Producer enable you tocreate graphical images, music, and sounds for your web site. ou canuse the +icrosoft Image ;omposer to create engaging images for yourweb pages. The Image ;omposer supports the Adobe Photoshop fileformat as well as I* and P formats. The Image ;omposer is simpleto use, and you dont have to be a graphic artist to master it. The+usic Producer enables you to create music and sound effects for yourweb site. ou pic' from over >22 pre"defined styles of music and canmodify the arrangement of instruments as well as the tempo.
Again, the goal of both of these products is to provide a rich andrewarding e)perience for the user. The +edia +anager enables you tomanage all of your multimedia files through the use of speciali=edfolders. y using +edia +anager, you can properly organi=e yourimages, sounds, video clips, and other multimedia files.
4ow consider some of the 'ey features for building robust server
applications. $isual Inter%ev enables you to create dynamic web pagesthrough the use of Active #erver Pages. The concept of Active #erverPages was touched on earlier in the day. As a refresher, Active #erverPages are HT+D pages that contain server"side script. The script codecan be either $#cript, ava#cript, or some other scripting language.The Active #erver Page, or .asp file, resides on the server machine ande)ecutes before being downloaded to the browser.
Active #erver ;omponents are a significant part of building distributedand powerful applications. Active #erver ;omponents are programs,%DDs, or e)ecutables (515s!, that are built using the ;omponent7b&ect +odel (;7+! specification. $isual asic, $isual ;
-
8/12/2019 31370683 Web Technologies
83/93
-
8/12/2019 31370683 Web Technologies
84/93
What Is Visual InterDe$
The -orld -ide -eb (---! has made the Internet come alive formany new users. In the initial stages, users reali=ed that they couldview numerous documents on various topics from all over the world.
Through the ---, people have access to a plethora of 'nowledge.4ot only can you read about many interesting topics on the -eb, butyou also can find information about your favorite products andservices.
7nce you have gained this 'nowledge, you will invariably want to acton it. #ome companies have built -eb"based applications, enablingyou to buy their products and services electronically over the Internet.7ther companies enable you to fill out registration information to beginreceiving certain services. The point is, applications enable the user to
act on the 'nowledge they have gained. usinesses can capitali=e onopportunities sooner by becoming closer to the customer through avirtual mar'etplace. $isual Inter%ev provides all the necessary tools tobuild these vital applications for the -eb.
$isual Inter%ev is a comprehensive, -eb"based applicationdevelopment tool. $isual Inter%ev provides an integrated environmentthat brings together various technologies to wor' towards a commongoal of building robust and dynamic applications for the -eb. $isualInter%ev achieves this integrated development environment throughthe use of the %eveloper #tudio shell interface, first used in +icrosofts
$isual ;
-
8/12/2019 31370683 Web Technologies
85/93
+anaging your web site once it has been developed is a very crucialfunction. $isual Inter%ev provides a set of tools to view and maintainyour site. These tools are similar and compatible with the sitemanagement tools found in +icrosoft *rontPage.
$isual Inter%ev supports the ma&or ob&ect"based technologies thate)ist for developing -eb"based applications, including Active1 controlsand ava applets. $isual Inter%ev supports the use of third"partyActive1 controls and enables you to integrate your own customActive1 controls. $isual Inter%ev also provides %esign"time ;ontrolsthat enable you to set control properties when youre designing yourapplication and then use this functionality at runtime without theoverhead of a typical Active1 control.
In a nutshell, $isual Inter%ev is an e)citing new tool that significantlyaugments a -eb developers productivity. In this ne)t section,