Tamil Nadu TRB computer instructors Grade1 exam
----
ASP – Active Server Page
Client Server Architecture
ASP
Introduced in 1998 by Microsoft
File extension .asp
To make dynamic web pages
Executing scripts in web server
Server side scripting language
We can embed the ASP code inside a HTML code
Can create dynamic web sites.
Can respond to user queries requested from HTML forms
Can Access to databases / File system or other server data and
return results to a browser
Provide web security since ASP code cannot be viewed in a
browser
HTML vs ASP
When a browser requests a normal HTML file, the server just
returns the file.
When a browser requests an ASP file, the server passes the
request to the ASP engine which reads the ASP file and
executes the server scripts in the file.
Then ASP file is returned to the browser as plain HTML.
IIS (Internet Information Server) is the Web server used to
serve the Web pages(HTML / ASP)
Variables:
Containers to hold some value(s)
Type variant
Case insensitive
Should begin with a letter or _
Can’t contain special characters except _
Maximum length 255
Array variable:
names(2)
names(0) = “name 1”
names(1) = “2”
names(2) = “name 3”
sencodName = name(1);
0 1 2
Name
1
2 Name
3
Multidimensional array
Names(2,2)
Names(0,0) = “name 1”
0,0 0,1
1,0 1,1
Lifetime of Variables:
Variables declared inside procedure not accessible outside of
procedure and get destroyed once the execution of the
procedure is completed. (Implicit variables)
Variables declared outside of procedure can be accessed
anywhere in the ASP file
Session variables:
A variable stored in server for a single user session
Will be available in all the ASP files of the application
When user requested a page, global.asa file get created
Once the session is over (Session logout / browser close), the
variable will get destroyed
Default time of session 20 mns
Eg:
%
‘5 min session this is comment
Session.Timeout=5
Session(“username”) = “logged in user name”
‘ close the user session
Session.Abandon
%
Application variables:
A variable stored in server for all users
Will be available in all the ASP files of the application
In global.asa file we can add application variables
script language=”vbscript” runat=”server”
Sub Application_OnStart
application(“varname”) = “initial value”
appliaiton(“users”) = 1
End Sub
script
In ASP file we can read application variables as below:
%
Response.write(Application(“users”));
%
0 Comments