The Server object provides access to methods and properties on the server. Most of these methods and properties serve as utility functions.
Server.property|method([parameters])
FoxWebPath | The location where the FoxWeb software was installed. |
AddScriptTimeout | Extends the Script Timeout setting for the current script. |
Execute | Calls a FoxWeb FWX script. |
HashMD5 | Converts a string of arbitrary length to a 128-bit "fingerprint", using the MD5 algorithm. Can be used in conjunction with the EncryptPassword property of the Auth object. |
HTMLEncode | Applies HTML encoding to a string. |
JSEscape | Encodes a text for inclusion in a JavaScript string. |
JSUnescape | Reverses the effects of JSEscape. |
SetScriptTimeout | Sets the Script Timeout setting for the current script. |
ToString | Converts a variant of any data type to a string. |
Transfer | Transfers control to another FoxWeb FWX script. |
URLDecode | Converts a previously URLEncoded string back to its original (non-URLEncoded) content. |
URLEncode | Applies URL encoding, including escape characters, to a string. |
The Server.FoxWebPath property returns the directory where the FoxWeb software was installed.
This property is read only.
sPath = Server.FoxWebPath
The Server.AddScriptTimeout method extends the Script Timeout setting.
Server.AddScriptTimeout(nSeconds, [bFromNow])
The number of seconds to extend the Script Timeout by.
If this optional argument is set to .T., then the method extends the timeout to nSeconds from the time of the call -- otherwise it simply adds nSeconds to the total ScriptTimeout setting.
|
The Server.Execute method calls an FWX script from another FWX script or from a regular PRG script.
cRetValue = Server.Execute(cScriptName, [vParam1, vParam2, ...])
Specifies the name and location of the script to be called.
A list of parameters that can be passed to the specified script name. You can pass up to 20 parameters of any data type, separated by commas.
Variant: The value returned by the script.
The HashMD5 method utilizes the MD5 algorithm to convert a string of arbitrary length to a 128-bit "fingerprint". It is conjectured that it is computationally infeasible to produce two messages having the same message digest, or to produce any message having a given pre-specified target message digest. The MD5 algorithm is intended for digital signature applications, where a large file must be "compressed" in a secure manner before being encrypted with a private (secret) key under a public-key crypto-system. In essence, MD5 is a way to verify data integrity, and is much more reliable than checksum and many other commonly used methods. The Server.HashMD5 method returns its value as a 32-character string, corresponding to the hexadecimal representation of the 128-bit fingerprint.
In FoxWeb the HashMD5 can be used to "encrypt" passwords that will be used in conjunction with the EncryptPassword property of the Auth object.
cFingerprint = Server.HashMD5(cTextString)
The string to be converted.
Character: A 32-character string, corresponding to cTextString after it is processed with the MD5 algorithm.
The Server.HTMLEncode method applies HTML-encoding to a specified string. HTML-Encoding a string can be useful in situations where you want the browser to display reserved HTML characters such as < and >. When browsers encounter these characters, they try to interpret them as HTML tags. To prevent this you must encode them with the HTMLEncode method.
cOutput = Server.HTMLEncode(cSource])
Specifies the string to encode.
Character: The HTML-Encoded string.
|
In the above example the HTMLEncode method will return the following string:
The <B> tag turns text into bold type |
The Server.JSEscape method can be called to convert text into a valid format for use in a JavaScript string. The following characters are translated: \, ", ', Carriage Return (ASCII 13), Line Feed (ASCII 10) and Tab (ASCII 9).
cOutput = Server.JSEscape(cSource)
Specifies the string to encode.
Character: The escaped string.
The Server.JSUnescape can return a JSEscaped string back to its original form. It can be used to manually deserialize JSON strings.
cOutput = Server.JSUnescape(cSource)
Specifies the string to unescape.
Character
The Server.SetScriptTimeout method sets the Script Timeout setting for the current script.
Server.SetScriptTimeout(nSeconds)
The number of seconds that the Script Timeout should be set to. If this value is smaller than the currently set Script Timeout then it is simply ignored.
The Server.ToString method converts variants of most data types supported by VFP into character strings. Supported data types are Character, Date, DateTime, Numeric, Memo and Boolean. Character and Memo values are returned without any conversion, while Boolean values are returned as "True" or "False".
cOutput = Server.ToString(vSource)
Specifies the value that is to be converted to character format.
Character: The converted value.
The Server.Transfer method calls an FWX script from another FWX script or from a regular PRG script. It works similarly to Server.Execute with the exception that control does not return back to the calling script. It is equivalent to a Server.Execute followed by Response.End.
Server.Transfer(cScriptName, [vParam1, vParam2, ...])
Specifies the name and location of the script to be called.
A list of parameters that can be passed to the specified script name. You can pass up to 20 parameters of any data type, separated by commas.
The Server.URLDecode method converts a previously URL-Encoded string back to its original content. Browsers URL-Encode the Query String and in most cases the POST data before sending it to the Web server. Even though the
cOutput = Server.URLDecode(cSource)
Specifies the string to decode.
Character: The URL-Decoded string.
|
The Server.URLEncode method can be called to convert a string into a valid format for use in a URL. Characters such as '&' are converted to codes as they have special meanings when found within a URL. The new encoded string is returned.
cOutput = Server.URLEncode(cSource)
Specifies the string to encode.
Character: The URL-Encoded string.
|