Flow control ability in ASP3.0 one [turn]

Source: Internet
Author: User
Tags execution http request new features php file client
asp3| Control With the introduction of PHP4.0 and JSP technology and the significant security issues that continue to occur in IIS, Microsoft's ASP market seems to be narrowing, but Microsoft will not give up, so on the basis of ASP2.0 launched the ASP3.0, added some new features: new flow control capabilities , Data shaping Technology (refer to: http://www.aspcn.com/showarticle.asp?id=28), Script-free ASP, more component selection, XML support, scripting components, encryption Techniques for ASP scripting code, and so on. In fact, I think that there is not much change, or I know about ASP3.0 is too little (in fact, I think Microsoft may give up the ASP, but the eyes turned to the "asp+", asp+ is still in the testing phase, but the author from a number of foreign sites to see, hehe, Our next thing on the win platform may be asp+, so ASP3.0 has not changed much, but then, for those users who use the win system platform, I suggest that you use ASP, so we introduce the "flow control ability in ASP3.0" below.


ASP3.0 flow control Technology In fact refers to the program flow, said the popular point is the process of the program, ASP3.0 has two new flow control methods: "Server.Transfer" and "Server.Execute", I will be the two methods of a rough introduction to everyone, In order to display its function concretely, I have compared Response.Redirect with Server.Transfer's use!
Typically using the Response.Redirect statement for address steering, ASP3.0 provides a new way for us to be more efficient. Let's take a look at how Response.Redirect and Server.Transfer respectively run!

The Response.Redirect actually sends an instruction (including a new address) to the browser when the server encounters the statement, and then lets the browser send the HTTP request, requesting the new HTTP address after the Response.Redirect, as follows:
Browser ASP file request-> Server execution-> encounter Response.Redirect statement-> server send Response.Redirect address to client side of browser-> The browser requests a new address (the address behind the Response.Redirect returned by the server) this is the whole process of a small response.redirect, do not see do not know, a look scared! It has so many processes, it's really scary ... and the Server.Transfer statement in ASP3.0 is directed to the following address after receiving the address, the process is as follows:
Browser ASP file request-> Server execution-> encountered Server.Transfer statement-> server to new file.
This will be less than a process! Also shorten the server-> client-> server access to each other time! But it is worth reminding you of the point is that the Server.Transfer with the address is the best HTML file or ASP file, not a third party loaded things, such as PHP, if so, the program is not the normal execution, because the file is directly to the ASP's engine analysis (alas , what does Microsoft teach people to say? Do not know this is not considered, or Microsoft's domineering), you will not get the results! In the following program, we will show you this as
Let's take a look at the following code:
(File: response.asp:)
<!--code starts-->
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "Author" content= "Ba Junjie" >
<meta name= "Keywords" content= "asp,www.aspcn.com" >
<title>response Test </title>
<body>
<%response.redirect "test.php"%>
</body>
<!--code End-->
The code for the test.php file is as follows:
<!--code starts-->
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "Author" content= "Ba Junjie" >
<meta name= "Keywords" content= "asp,php,www.aspcn.com" >
<title>response Test </title>
<body>
? Echo <center> This is a test, Hello! Welcome you to visit our website <a href=http://www.aspcn.com>www.aspcn.com</a></center> ";?>
</body>
<!--code End-->
OK, let's test the code, see the results? Let's take a look at Server.Transfer's usage statement, which is as follows:
Server.asp (in fact, directly apply response.asp on it):
<!--code starts-->
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "Author" content= "Ba Junjie" >
<meta name= "Keywords" content= "asp,www.aspcn.com" >
<title>response Test </title>
<body>
<%server.transfer "test.php"%><!--Note this statement-->
</body>
<!--code End-->
Perform a server.asp! Hey, weird, nothing! But if you look at the code that is interpreted by IE, the code is as follows (be careful not to be confused by the comments I use in the HTML below):
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "Author" content= "Ba Junjie" >
<meta name= "Keywords" content= "asp,www.aspcn.com" >
<title>response Test </title>
<body>
<!--code starts-->
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "Author" content= "Ba Junjie" >
<meta name= "Keywords" content= "asp,www.aspcn.com" >
<title>response Test </title>
<body>
? Echo <center> This is a test, Hello! Welcome you to visit our website <a href=http://www.aspcn.com>www.aspcn.com</a></center> ";?><!--Notice that this PHP statement is seen- ->
</body>
<!--code end--><!--notice this statement-->
</body>
"################################################### (end of code)
The test.php file is included as a text file, but if we replace the Server.Transfer "test.php" in the original server.asp file with Server.Transfer "Response.asp" In a try (this, in fact, is to let you understand the ASP's engine for Server.Transfer specific parsing case), to see the results? Is it the same result that we run response.asp directly???
I don't know, are you confused about Server.Transfer's usage now? I'm a little confused! But don't forget the key to my writing: Server.Transfer is better than Response.Redirect, because the former is less than a process, speed up, save time, the latter I will not say, just remind you a little is server.tr



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.