18.2 Properties Reference

MachineName

stringvar = Server.MachineName

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

Parameter

stringvar

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

Example

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

Notes

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

ScriptTimeout

intvar = Server.ScriptTimeout

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

Parameters

intvar

An integer variable that receives the script timeout value.

Example

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

Notes

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.



ASP. NET in a Nutshell
ASP.NET in a Nutshell, Second Edition
ISBN: 0596005202
EAN: 2147483647
Year: 2003
Pages: 873

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net