Response.Write Method

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

Write(
      variant
)

Parameters

  • variant
    The data to write. This parameter can be any data type supported by the VBScript 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 translates the escape sequence when it processes the script.

Return Values

This method has no return values.

Example Code

The following example use the Response.Write method and HTML to send output to the client:

<H3 align=center>I just want to say <% Response.Write "Hello World.</H3><BR>" %>  
Your name is: <% Response.Write Request.QueryString("name") %> <BR> 

The following example uses <%= instead of Response.Write.

The date is: <%= Date %> <BR> 

The following example adds an HTML tag to the Web page output. Because the string returned by the Write method cannot contain the character combination %>, the escape %\> is used instead.

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

The previous example produces the following output:

<TABLE WIDTH = 100%>  

Applies To

Response Object

Remarks

If you do not want to use the default language code page, output from Response.Write can be encoded using different code pages by setting @CodePage, Response.CodePage, Session.CodePage, or the AspCodePage metabase property. For more information, see the Response.CodePage and Response.Charset reference pages.

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

See Also