The Response Object provides a set of methods and properties for controlling what information is sent to the requesting browser in response to the request. This includes sending information directly to the browser, redirecting the browser to another URL, or setting cookie values.
You use the Response object to control the information you send to a user. This includes sending information directly to the browser, redirecting the browser to another URL, or setting cookie values.
Response.property|method([parameters])
Buffer | Indicates whether to buffer script output. |
CacheControl | Determines whether proxy servers are able to cache the output generated by FoxWeb scripts. |
Charset | Appends the character set name to the HTTP header. |
ContentType | Specifies the HTTP content type for the current output. |
Expires | Specifies the timeout after which a page cached on a browser expires. |
ExpiresAbsolute | Specifies the date and time after which a page cached on a browser expires. |
OutputBuffer | Returns the contents of the buffer, which is about to be written to the client. |
Status | Determines the status line returned in the HTTP header. |
AddHeader | Adds a name=value line to the HTTP header returned to the browser. |
Clear | Clears the content of the output buffer. |
DelCookie | Instructs the browser to delete a cookie. |
End | Stops processing the FoxWeb script and returns the current content. |
Flush | Sends the content of the output buffer to the browser immediately. |
Redirect | Sends a redirect message to the browser, causing it to attempt to connect to a different URL. |
SetCookie | Sends a cookie to the browser. |
Write | Sends content to the browser, or appends content to the output buffer, depending on the Response.Buffer setting. |
The Response.Buffer property indicates whether script output should be buffered. When script output is buffered, the server does not send a response to the client until the current scripts has been processed, or until the Response.Flush or Response.End method has been called.
This property is read/write.
Response.Buffer = lFlag
The Response.CacheControl property sets or returns the value of the cache-control HTTP header, which determines whether proxy servers can cache output returned by the script. The default value for this property is "Private", which instructs proxy servers not to cache output.
This property is read/write.
Response.CacheControl = cHeader
All HTTP headers must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to set this property after you have already sent content to the browser, FoxWeb will return an error message.
The Response.Charset property appends the name of the character set (for example
This property is read/write.
Response.Charset = cCharset
All HTTP headers must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to set this property after you have already sent content to the browser, FoxWeb will return an error message.
The Response.ContentType property sets or returns the value of the Content-Type HTTP header, which informs the browser of the kind of data included in the reply. It can be used to serve non-HTML data from FoxWeb scripts.
This property is read/write.
Response.ContentType = cContentType
The default value for this property is
All HTTP headers must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to set this property after you have already sent content to the browser, FoxWeb will return an error message.
The Response.Expires property sets the length of time before a page cached on a browser expires. If the user requests the same script before it expires, the cached version is displayed.
In VFP 6.0 and above this property is write only. The actual expiration timestamp can be obtained from Response.ExpiresAbsolute.
In versions of VFP prior to 6.0 this property is read/write.
Response.Expires = nMinutes
Different browsers behave differently when a page expires. For example Netscape Navigator does not even allow viewing an expired page when the back button is pressed. Internet Explorer, on the other hand, does allow the viewing of an expired page when the back button is pressed. Both browsers request a new copy of the page from the server, if the user clicks on a link, pointing to that page.
Due to differences in the system time setting between the server and the browser, it is possible that you will not get the desired behavior when you set this property.
A value of 0 will cause the browser to expire the page immediately. This setting will always work regardless of differences in the system time setting between the server and the browser, because it sets the expiration date to 1990.
All HTTP headers must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to set this property after you have already sent content to the browser, FoxWeb will return an error message.
The Response.ExpiresAbsolute sets the exact date and time, when a page cached on a browser expires. If the user requests the same script before it expires, the cached version is displayed.
This property is read/write.
Response.ExpiresAbsolute = tExpirationDateTime
Different browsers behave differently when a page expires. For example Netscape Navigator does not even allow viewing an expired page when the back button is pressed. Internet Explorer, on the other hand, does allow the viewing of an expired page when the back button is pressed. Both browsers request a new copy of the page from the server, if the user clicks on a link, pointing to that page.
Due to differences in the system time setting between the server and the browser, it is possible that you will not get the desired behavior when you set this property.
All HTTP headers must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to set this property after you have already sent content to the browser, FoxWeb will return an error message.
The Response.OutputBuffer property can be used to modify the output that is about to be returned to the client.
This property is read/write.
Response.OutputBuffer = cOutput
This property should not be used to create new content. Use Response.Write instead.
|
The code in the above example strips all carriage returns from the output.
The Response.Status property specifies the value of the status line returned by the server. Status values are defined in the HTTP specification.
This property is read/write.
Response.Status = cStatusHeader
The default value for the status property is
All HTTP headers must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to set this property after you have already sent content to the browser, FoxWeb will return an error message.
The Response.AddHeader method adds an HTTP header with a specified value. Once a header has been added, it cannot be removed.
Response.AddHeader(cHeaderName, cHeaderValue)
All HTTP headers must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to use this method after you have already sent content to the browser, FoxWeb will return an error message.
The Response.Clear method clears the output buffer, by erasing all content.
Response.Clear
This method erases only the response body -- it does not erase response headers.
The Response.DelCookie method instructs the browser to forget a cookie that was previously sent to it.
Response.DelCookie(cCookieName, [cCookiePath], [cCookieDomain])
This method works by re-sending the cookie to the browser, specifying an expiration date that is in the past.
Cookie headers are part of the HTTP header, so they must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to use this method after you have already sent content to the browser, FoxWeb will return an error message.
The Response.End method instructs FoxWeb to stop processing the script and return the current result to the browser. The remaining contents of the script are not processed.
Response.End
If this method is included in a top-level script, it is equivalent to the RETURN command; however, the RETURN command would not work in a procedure or script, called by another script, because it would not stop script processing, but would simply return control to the calling procedure.
The Response.Flush method instructs FoxWeb to send buffered output immediately.
Response.Flush
This method can be used to send output to the browser at specific stages of script execution, without having to disable output buffering. It is useful in cases where you want to inform the user about the progress of the script, or in cases where you want to send partial results while the script is executing.
The Response.Redirect method instructs the browser to connect to a different URL.
Response.Redirect(cURL)
This method works by sending a
All HTTP headers must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to use this method after you have already sent content to the browser, FoxWeb will return an error message.
The Response.SetCookie method sends a cookie to the browser. For more information on cookies and the various parameters of this method refer to the Session Management topic.
Response.SetCookie(cCookieName, cCookieValue, [tCookieExpires], [cCookiePath], [cCookieDomain], [lCookieSecure], [lHttpOnly], [cSameSite])
If you want the new cookie to be sent with all requests to the server, regardless of path then you should specify "/" in the cCookiePath parameter.
Cookie headers are part of the HTTP header, so they must be sent before any content is sent to the browser. If you disable buffering of script output and attempt to use this method after you have already sent content to the browser, FoxWeb will return an error message.
The Response.Write method writes a string to the output buffer.
Response.Write(vOutput)