Main Page

  Previous Section Next Section

18.2 Properties Reference


stringvar = Server.MachineName

Returns a string containing the name of the server on which the code is executing.



A string variable that receives the machine name from the property.


This code example declares a string variable, assigns the MachineName property value to the string variable, and then sets the text property of the Message label to the value of ServerName:

Sub Page_Load( )
   Dim ServerName As String
   ServerName = Server.MachineName
   Message.Text = "The name of the server is " & ServerName & ".<br/>"
End Sub


This property can be useful for code that needs to be easily portable, but needs to access resources that require the server name.


intvar = Server.ScriptTimeout

Returns an integer containing the length, in milliseconds, a request is allowed to run before timing out.



An integer variable that receives the script timeout value.


This code example declares an integer variable, sets the ScriptTimeout value to 120 seconds, assigns the ScriptTimeout property value to the variable, and then sets the text property of the Message label to the value of the variable:

Sub Page_Load( )
   Dim Timeout As String
   Server.ScriptTimeout = 120
   Timeout = CStr(Server.ScriptTimeout)
   Message.Text = "The current ScriptTimeout value is  " & _
      Timeout & ".<br/>"
End Sub


You can use this property to extend or reduce the timeout value in order to allow longer-running processes time to complete, or you can use ScriptTimeout to reduce the overhead associated with inefficient processes by terminating them before completion. The default for this value is set to an extremely high number so that a script will not time out by default. This is for backward compatibility with classic ASP.

      Previous Section Next Section