Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

ASP Response Object Write Method

The Write method writes a specified string to the current output.

Syntax: ASP Response Object Write Method

Response.Write variant

Parameters: ASP Response Object Write Method

variant

The data to write. This parameter can be any data type supported by the Visual Basic VARIANT data type, including characters, strings, and integers. This value cannot contain the character combination "%>"; instead you should use the escape sequence "%\>". The Web server will translate the escape sequence when it processes the script.

Remarks: ASP Response Object Write Method

VBScript limits the size of string literals to 1022 bytes, therefore variant cannot be a string literal of more than 1022 bytes. You can, however, specify variant as the name of a variable containing more than 1022 bytes.

Examples: ASP Response Object Write Method

The following VBScript, in which a is repeated 1023 times in the string literal will fail:

<% Response.Write "aaaaaaaaaaaa...aaaaaaaaaaaaaaaaaa"

The following VBScript, in which `a' is repeated 4096 times in the string variable will succeed:

AVeryLongString = String(4096, "a")

Response.Write(AVeryLongString)

Using the Response.Write method to send output to the client:

I just want to say <% Response.Write "Hello World." %>

Your name is: <% Response.Write Request.Form("name") %>

The following script demonstrates adding an HTML tag to the Web page output. Because the string returned by the Write method cannot contain the character combination, "%>", the escape, "%\>", has been used instead:

<% Response.Write "<TABLE WIDTH = 100%\>" %>

The script outputs:

<TABLE WIDTH = 100%>

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.