Using the Response Object 2003 in ASP programming

Source: Internet
Author: User
Response| Program | object | Design Response object in ASP programming the main function is from browser End-to-end to the server to transfer data to the browser client, we know that the ASP script is executed on the server side, he did not output "value" function. To have the output "value", you must rely on the response object.

Here we will focus on some of the features that are most commonly used. That is, some of the functions that are often used in programming are as follows:

(1). Response.Write Send Message to Browser
(2). Response.End to effectively abort code
(3). Response.Redirect page Redirection

How do I use Response.Write to send information to a browser?

In the following response.asp is a program to send information to the client, in the program using a built-in function--dateadd, for this feature can refer to the following related documents:
Http://help.activeserverpages.com/iishelp/VBScript/htm/vbs90.htm.
Response.asp Program source code:

The following interfaces are implemented:



Figure 01:response.write Sending information to the browser

How can Response.End effectively abort the code?
The following is the source program that terminates a page operation with Response.End end.asp and the running interface after execution:

End.asp:
<title> end.asp </title> <body color = "#FFFFFF" ><%when = Now () tommorow = DATEADD ("D", 1, when) Twoweekslater = Date Add ("W", 2, when) Monthlater = DateAdd ("M", 1, when) Sixminuteslater = DateAdd ("n", 6, when) Sixhourslater = d Ateadd ("H", 6, when) Response.Write "Now Time: <b>" & When & "</b> <br>" Response.Write "one months from now: <b>" & Mo Nthlater & "</b> <br>" Response.endresponse.write "two weeks from now: <b> & twoweekslater & </b> <br>%> from now 6 seconds: <b> <%= sixminuteslater%> </b> <br> 6 hours from now: <b> <%= sixhourslater%> </b> <br>

Run this program, the execution interface is as follows:



Figure 02:end.asp Program Execution interface

A response.end statement is visible in the end.asp program: if there is no such statement, the following is the interface of the program after execution:



Figure 03: The execution interface of the Masked Respons.end statement in the program

This shows how response.end effectively stops code execution.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.