The main function of the response object in ASP programming is to transfer data to the browser from the browser to the server, we know that the ASP script is executed on the server side, and he does not have the function of output "value". 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:
<html>
<head>
<title> response.asp </title>
<body color = "#FFFFFF" >
<p>
<%when = now ( )tommorow = dateadd ( "d" , 1 , when )twoweekslater = dateadd
( "ww" , 2 , when )fourteenweekdayslater = dateadd ( "w" , 14 , when )monthlater = dateadd ( "m" , 1 , when )sixminuteslater = dateadd ( "n" , 6 , when )sixhourslater = dateadd ( "h" , 6 , when )fortysecslater = dateadd ( "s" , 40 , when )response.write "现在时间:
<b>" & when & "</b> <br>"response.write "明天此时:
<b>" & tommorow & "</b>
<br>"response.write "一月以后此时:
<b> " & monthlater & " </b>
<br>"%>从现在以后6秒钟:<b> <%= sixminuteslater %> </b>
<br> 从现在以后6小时是:<b> <%= sixhourslater %> </b>
<br> 从现在以后40秒是: <b> <%= fortysecslater %> </b>
<br> </body> </html>
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 = dateadd ( "w" , 2 , when )monthlater = dateadd ( "m" , 1 , when )sixminuteslater = dateadd ( "n" , 6 , when )sixhourslater = dateadd( "h" , 6 , when )response.write "现在时间:
<b>" & when & " </b>
<br> "response.write "从现在以后一个月时间: <b>" & monthlater & "</b> <br>"response.endresponse.write "从现在以后二周时间:
<b>" & twoweekslater & "</b>
<br>"%>从现在以后6秒时间:
<b> <%= sixminuteslater %> </b>
<br> 从现在以后6个小时:<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.