The Server Object
The Server object makes us available the methods and properties of our server
( IIS ).
Syntax
Server.property|method
Properties
Description
ScriptTimeout
An integer which specifies time
in seconds until which the script can run after that the server aborts the
script and displays an error message.
Methods
Description
CreateObject
Creates an instance of the object ( a
component, application or a scripting object ). The component can be
instantiated by giving its CLSID or ProgID in the Server.CreateObject
method e.g. Server.CreateObject ("MSWC.MyInfo").
Execute
Executes the given .asp page
and then returns the control to the page who called the method. Very
useful method which can be used to execute another .asp page
without leaving the current page and then control is passed back to the
calling page.
GetLastError
Returns an ASPError object
which can be used to get information about the last error occured in the
ASP script.
HTMLEncode
Provides HTML encoding to a given
string. All non-legal HTML characters are converted to their equivalent
HTML entity e.g. "<" is converted to < .
MapPath
Maps the specified virtual or relative
path into physical path of the server.
Transfer
Transfers the control of the page to
another page specified in the URL. Note that unlike Execute,
control of the page is not returned to the page calling the Server.Transfer
method.
URLEncode
Provides URL encoding to a given
string e.g. Server.URLEncode ("http://www.stardeveloper.com")
returns http%3A%2F%2Fwww%2Estardeveloper%2Ecom.
The Session Object
The Session object is automatically created every time client browser access
pages from your web site. Session object is specific for every user and varies
from user to user. It can be used to store variables specific for a user and IIS
will maintain these variables when the client moves across pages within your
site. You can create and access Session scope variables. You can store user
specific preferences within Session object such as 'font-size, background-color'
etc.
Note that scripts for different Events are to be
declared in global.asa file.
Syntax
Session.collection|property|method
Collections
Description
Contents
Contains all the items which have been
added to the Session object. You can iterate through the Contents
collection and retrieve a list of all the items added or you can retrieve
a specific item. Note that it contains all the Session items except
the ones created using <object> element.
StaticObjects
Contains all the items which have Session
scope created using <object> element. As with Session.Contents
collection you can iterate through the StaticObjects collection
to get a list of items or you can get a specific item out of the StaticObjects
collection.
Properties
Description
CodePage
An integer which defines the
code page to be used to display content to the client browser e.g. code
page 1252 is used to for American english and most European languages and
932 is used for Japanese kanji.
LCID
Stands for locale identifier. It is a
standard international abbreviation that uniquely identifies the locale
e.g. LCID 2057 stands for British locale.
SessionID
A long which returns the
session identifier for this client browser.
Timeout
An integer which specifies a
time out period in minutes. If the client doesn't refresh or request any
page of your site within this time out period then the server ends the
current session. If you do not specify any time out period then by default
time out period is 20 minutes.
In order to post questions/comments, you must be logged-in. If you are not a member
yet, then signup, otherwise login. Once you
login then come back to this page and you'll see a form right here which will allow you
to post comments/questions.
Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a
reply to the thread you have subscribed.