Two server-side webpage redirection methods in IIS5

Source: Internet
Author: User
Two server-side webpage redirection methods in IIS5
IIS5 provides two methods for server-side webpage redirection (or redirection,
One is the Server. Transfer method, and the other is the Server. Execute method.
They are server-side redirection, because the redirection between different pages is directly on the server side.
The client can only see the results, but cannot see the redirection process.
This is the same as what we used in IIS4.
The Response. Redirect Method is different.
In the past, when we needed to switch from one page to another, we generally used
The Redirect Method of the Response object. For example, on a page that requires user verification
Go to the user login page when you do not log on. The simple example code is as follows:
Content. asp
<%
If Session ("isLogin") = "" Then
Response. Redirect "Login. asp"
End If
'Normal content
%>
In fact, the Response. Redirect Method returns a 302 flag code to the browser in the Http Header status,
HTTP 1.0 302 Object Moved
Location URL
In this way, the browser actually requests the server's content. asp file. After the content. asp file is processed
Tell the browser that you first access the login. asp file, so the browser then sends a request to the server to go to the login. asp page.
Therefore, it turns into a bend. In this way, when the client network condition is not good, the two requests will increase greatly
Reduces the response speed of applications and even occupies excess bandwidth.
In particular, when parameters need to be passed, there are also some problems.
In IIS5, the Server. Transfer and Server. Execute methods are provided.
Both methods are switched between servers, so the network bandwidth of the client can be reduced,
However, the server needs to save some state of Program 1, which also consumes a certain amount of memory.
So what are the differences between Server. Transfer and Server. Execute?
The following example shows two files: file1.asp and file2.asp.
We all need to switch to file2.asp in file1.asp.
When using the Tansfer method:
File1.asp
<%
Response. Write "File 1 Header <br>"
Server. Transfer "file2.asp"
'At this point, the execution of the following statements will be stopped, turning
Response. Write "File 1 Footer <br>"
%>
File2.asp
<%
Response. Write "ciqiqiang 2"
Related Article

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.