The ASP Server object is used to access methods and properties on the server. The Server object provides a variety of functions such as the ability to execute other ASP pages within a page or map a virtual path on the physical server. The syntax, properties, and methods of the ASP Server object are as follows:

Properties

Setting the ScriptTimeout Value

<% Server.ScriptTimeout=value in seconds Server.ScriptTimeout=90 %>

Retrieving the value of the ScriptTimeout Property

<% Response.Write(Server.ScriptTimeout) %>

Methods

CreateObject

Syntax set variable=Server.CreateObject(progID)

<% set objCmd=Server.CreateObject(“ADODB.command”) %>

Execute

Syntax Server.Execute(path)

<% Server.Execute(“page2.asp”) %>

GetLastError

<% Server.GetLastError() %>

HTMLEncode

Syntax Server.HTMLEncode(string)

<% Response.Write(Server.HTMLEncode(“A paragraph element uses the

tag.”)) %>

MapPath

Syntax Server.MapPath(path)

<% Response.Write(Server.MapPath(“default.asp”) & “
”) Response.Write(Server.MapPath(“images/img1.jpg”) & “
”) %>

Output c:\inetpub\wwwroot\default.asp c:\inetpub\wwwroot\images\img1.jpg

Transfer

Syntax Server.Transfer(path)

<% Server.Transfer(“page2.asp”) %>

URLEncode

Syntax Server.URLEncode(string)

<% Response.Write(Server.URLEncode(“https://www.itgeared.com”)) %>