ASP Server Object

The Server object provides access to the utility functions of the server.


ScriptTimeOut Property
Used to set and return the amount of runtime, in seconds, for a script before it terminates.


CreateObject(ObjectID) Method
Creates an instance of an object (ObjectID) to use in an Active Server Page. This can be nearly anything, including self-written COM/COM+ objects.

Execute(Path) Method (v 3.0)
Allows you to call another ASP page from inside an ASP page. When the called ASP page completes its tasks, you are then returned to the calling ASP page.

GetLastError Method (v 3.0)
Returns an ASPError object that describes any pre-processing, runtime, or script compiling errors that occured.

HTMLEncode(String) Method
Applies HTML syntax to a specified string of ASCII characters.

MapPath(Path) Method
Maps a relative or virtual path to a physical path.

Transfer(Path) Method (v 3.0)
Allows you to transfer all of the state information for all of the built-in objects from one ASP page to another. Unlike the Execute method, when the ASP page that you have transferred to is finished, you do not return to the original ASP page.

URLEncode(String) Method (v 3.0)
Applies URL rules to a specified string of ASCII characters.

Tips & Hints

Redirect using Server.Transfer
A new feature of ASP 3.0 and IIS 5.0, Server.Transfer is a much better way to do client redirection then the old Response.Redirect. Why?

Response.Redirect tells the browser to request a different page. A new request means that the browser has to make two requests to the server (one for the page containing the Response.Redirect directive and one for the page it is redirected to). Server.Transfer, on the other hand, transfers execution to a different ASP page on the server (no additional request!). This decreases load on the server (one request instead of two), and increases the response time for the client.

Besides better performance, Server.Transfer makes programming easier. Anyone who has programmed in ASP and had to redirect to a new page AND remember the passed query string or form values knows what I mean. Used to, before you could redirect, you would have to request and save all of those variables and then include them as a query string on your Response.Redirect URL or save each of them as a Session variable. No longer! Server.Transfer passes all of the items in the Request collections to the new page!

Back to ASP Objects


(v 3.0) indicates that this feature is only available with ASP Version 3.0, which shipped standard with IIS 5.0