3.5 Response Object

Sends the values to the client browser from the server based on the HTTP request.

3.5.1 Cookies property

Sets or returns the collection object of the cookie sent based on the received HTTP request.

Syntax

Response.Cookies = [Value As String]

Type

Collection object.

Attributes

Write.

Remarks

If the specified cookie does not exist it will be created. If the specified cookie is already existing, the old value will be reset to the new value. Response objects are always used to write the cookies.

Example

See sample in Value property.

3.5.2 Buffer property

Indicates whether the page output should be buffered.

Syntax

Response.Buffer

Type

Boolean.

TRUE if the output is buffered and the server does not send the output to the client until all the NSP scripts associated with the current page are processed or Flush () or End () methods are called.

FALSE if there is no buffering and the server sends the output as and when it is processed.

Attributes

Read/write.

Remarks

This property cannot be set after the server has sent the request to the client browser. Hence, Response.Buffer should be the first line in any NSP file. By default buffer property is set to TRUE.

3.5.3 CacheControl property

Sets or returns the specific value representing the cache control header to be PUBLIC or PRIVATE.

Syntax

Response.CacheControl = [Value As String]

Type

String. If this property is set to PUBLIC all the proxy servers will cache that page. If it is set to PRIVATE this page will be enabled only for private caching and all the proxy servers cannot cache this page.

Attributes

Read/Write.

Remarks

By default the Cachecontrol property is set to PRIVATE.

3.5.4 CharSet property

Appends the name of the specific character set (example: ISO-LATIN-7) to the content type header in the response object.

Syntax

Response.CharacterSet = (Charactersetvalue As String)

Type

String. specifies the character set of the page that is to be appended with the corresponding content type header.

Attributes

Read/Write.

3.5.5 ContentType property

Sets or returns the HTTP content type for the Response object.

Syntax

Response.ContentType = (ContentType As String)

Type

String. The content type is given in the form of formatted type or subtype. The formatted type is always for the general content type category and the formatted subtype is for the specific content type category.***

Attributes

Read/Write.

Remarks

By default the content type is set as text/HTML.

3.5.6 Expires property

Sets or returns the time (in minutes) after which the cache for that page in the browser will be cleared.

Syntax

Response.Expires = (Time As Long)

Type

Long.

Attributes

Read/Write.

Remarks

If the user returns to the page before the set expiry time, the cached version of that page will be displayed.

3.5.7 ExpiresAbsolute property

Sets or returns the date and the time at which the page cached in the browser will expire.

Syntax

Response.ExpiresAbsolute = 
(Datevalue As???),
(Timevalue As???)

Type

????

Attributes

Read/Write.

Remarks

If the user returns to that before the specified date and time, the cached version will be displayed.

3.5.8 PICS property

Adds or returns value to the pics label field in the response header.

Syntax

Response.Pics = (Label As String)

Type

String.

Attributes

Read/Write.

3.5.9 Status property

Returns the value of the status line returned by the server. Status values are defined based on the HTTP specification.

Syntax

Response.Status

Type

String comprising of a 3 digit number indicating the status code and a brief explanation for that code.

Attributes

Read/Write.

3.5.10 AddHeader method

Appends a new HTTP header with the specified value to the Response object.

Syntax

Response.AddHeader(
 Name As String,
 Value As String)

Parameters

Name

String representing the name of the new header file.

Value

String representing the initial value stored in the header file.

Return Values

Boolean. Returns TRUE if the header file is added successfully else returns FALSE.

Remarks

The header cannot be deleted once it is added to the Response object.

3.5.11 AppendToLog method

Adds the specified string at the end of the log entry generated by the web server.

Syntax

Response.AppendToLog(
LogEntry As String)

Parameters

LogEntry

String representing the log details to be added to the end of the log entry generated by the web server.

Return Values

Boolean. TRUE if the specified string is added successfully else returns FALSE.

Remarks

The same string can be added multiple times by calling the AppendToLog method. The sting will be appended to the existing log entry.

3.5.12 Break method

Inserts a line break in the response object.

Syntax

Response.Break()

Parameters

None.

Return Values

Boolean. Returns TRUE if the line break is inserted else returns FALSE.

3.5.13 Clear method

Clears the buffered HTML output for the response object, when Response.Buffer () is set TRUE for that object.

Syntax

Response.Clear()

Parameters

None.

Return Values

Boolean. Returns TRUE if the HTML buffer is cleared successfully.

Remarks

This method erases only the response body and not the response header.

3.5.14 End method

Intimates the web browser to stop processing the script and return the current result.

Syntax

Response.End()

Parameters

None.

Return Values

Boolean. Returns TRUE if the script processing is stopped once this method is called else returns FALSE.

3.5.15 Flush method

Sends the buffered output immediately.

Syntax

Response.Buffer()

Parameters

None.

Return Values

Boolean. Returns TRUE if the buffered output is sent else returns FALSE.

Remarks

This method will not work if Response.Buffer() is not called.

3.5.16 Redirect method

Intimates the web browser to connect to a different URL.

Syntax

Response.Redirect(
URL As String)

Parameters

URL

String representing the uniform resource locator to which the browser is redirected.

Return Values

Boolean. TRUE if the browser is redirected successfully else returns FALSE.

3.5.17 Write method

Writes a specified data to the current HTTP output sent to the client.

Syntax

Response.Write(
 Value As AnyType)

Parameters

Value

String representing the data to be added to the HTTP output.

Return Values

Boolean. TRUE if the data is written to the HTTP output else returns FALSE.