When I just understood 404.ASP before, I once fantasized to write all the program code into 404.ASP to realize a station that simulates the static webpage. The program code is as many as 100,000 lines, I'm afraid I will start climbing
Until I saw the server.transfer of ASP, the idea of generating a static page with 404 simulated the static page appeared in my mind. Now even in the big program, you can use the server.transfer in ASP to easily get it.
<!-#Include file = bin/404_qury->
< %
Select case bin_command
Case bin
Server.transfer (bin/web)
Case uploadFiles
Server.transfer (Bin/Send-Stream)
Case Else
Server.transfer (Bin/Send-404)
end select
%>
Hehe, to put it plainly, it is based on bin_command to judge whether it is very functional to achieve. If it is BIN, it is transferred to Bin/Web from the server.transfer The problem is to achieve the effect of the static page. There is no REWRITE in PHP. If you want URL friendship, usually practical path_info, and this program is simulated by the path_info in php by the server.transfer.
BIN/404_Query's source code is as follows:
< %
Urls = MID (request.querystring, Instr (request.querystring,: 80) +4)
if instr (urls,/)> 0 then
bin_command = left (urls, instr (urls,/)-1)
getfile = replace (urls, bin_command &/,)
else
bin_command = bin
end if
%>
This code is mainly to determine what bin_command is executed. First of all, see if it includes the secondary directory. If there is no secondary directory, it is assigned to BIN
Such as: demo.com/index5.html, then bin_command = bin, you can know
Demo.com/uploadFiles/123456.gif (This file actually corresponds to FILES/123456.gif), then bin_command = uploadFiles, you can know that you can give it to bin/send-Stream. 123456.gif. You can refer to the article I wrote an article Ap Practical Binarywrite and Adodb.stream.
Demo.com/111/222, then bin_command = 111 ″, there is no definition in select case, it is else, and handed it to Bin/Send-404 for processing.
In this way, all visitors (including: Baidu, Google), this site is a static page. As far as I know, 99.9%of the domestic IIS hosts do not support IsaPi_rewrite, and I have encountered it once because the resources are too serious and it will be canceled soon.
The following is what I saw on the ASP learning online, attached to the back for reference:
Call the server.transfer method, immediately terminate the execution of the first page and start executing the second page.
If the first page starts to write a response buffer, the second page is added to the buffer instead of replacing it.
If the buffer is open, this method will modify the http head, unless there is no content that has been sent. If the ASP buffer is closed, the HTTP head will not modify it.
When transmitted to other applications, the start page Application and Session objects will include application information.
Exemplary example
The following example page explains how to use the server.transfer method.
1.
<html>
<body>
<h3> Step 1 -FORM PAGE </h3>
<table border = 1>
<tr>
<th> Post </th>
<TD>
<FORM ACTION = PAGE2.ASP METHOD = Post>
<input type = text name = name/>
<input type = submit value = submit/>
</form>
</td>
</tr> <te>
</tr>
<th> get </th>
<TD>
<FORM ACTION = PAGE2.ASP METHOD = Get>
<input type = text name = name/>
<input type = submit value = submit/>
</form>
</td>
</table>
</body>
</html>
2. Put the following code as page2.asp (without quotation):
< % @Language = VBScript %>
<html>
<body>
<H3> Step 2 -Transfer Page </h3>
< %
Select Case UCASE
Case post
Server.transfer page3a.asp
Case Get
Server.transfer page3b.asp
Case Else
Response.write an unknown http verb was used.
End select
%>
</body>
</html>
3. Put the following code as page3a.asp (without quotation):
< % @Language = VBScript %>
<H3> Step 3A -Post Results </h3>
<p> Hello < % = request.form (name) %> </p>
4. Put the following code as page3b.asp (without quotation):
< % @Language = VBScript %>
<H3> Step 3B -get results </h3>
<p> Hello < % = request.querystring (name) %> </p>
Note: The last two pages are incomplete HTML pages. This is because both pages are added to the second page buffer.
Browse Page1.asp to test this instance.