I often see the website such as www.abc.com/?news or www.abc.com/?id=123. At first, I felt very mysterious. In fact The profound technology can be achieved with some simplest methods. Take ASP as an example to make good use of the server.transfer to achieve the above functions.
Assuming the address is www.abc.com/?news, how to show the news.asp we need? First of all, you must understand that no matter what server, there will be a default page, such as uploading index.html or index.htm to the homepage space, enter the URL, the default will always be transferred to the index page. Index.htm) is a default page. Of course, the same is true of Index.asp, but when these pages appear at the same time, it depends on the server settings. Now we create a new index.asp in the directory. Assuming the access path is www.abc.com/, then we can also use www.abc.com/index.asp to access this address. ASP is hidden.
Now let's use www.abc.com/?news to point to News.asp, open index.asp, and edit its source files, as follows:
<%
DIM TARGETPAGE
targetPage = request.querystring ()
if targetPage <> then
Server.transfer (targetPage+.sp)
end if
%>
Here is a request.querystring () to receive the characters, because our request string is? News, not like a traditional form of variable names. Get it? All the characters behind. Here we get string NEWS. Next judgment, if it is not empty, turn it into new.asp, and use server.transfer to turn. Here, the reason why you use server.transfer, you will find that the page has turned, but the browser address bar has not changed. It will not become www.abc.com/new.asp because of steering, which is based on the principle of server.transfer to achieve the purpose of hidden access pages.
However, the form is too simple, it is easy to make people guess the real address, then one more deeper, make an address mapping table, it is not difficult to establish a array, write the address name you want to turn, and then write it. Access through the form of www.abc.com/?arrayid, where Arrayid is the array of the corresponding array. Let's take an example:
<%
DIM TARGETPAGE, URLTable (4)
targetPage = request.querystring ()
urltable (1) = note
urltable (2) = list.asp
urltable (3) = HomePage.asp
urltable (4) = login.asp
Server.transfer (urLtable (targetPage))
%>
If we want to visit News.asp, we can use www.abc.com/?11. This address is not easy to make people guess the file naming method in the address information. For too much address steering, the volume of the array will increase, and it is not a good method, and it is not easy to maintain.
In contrast, the first method seems to be commonly used online, the second, and also uses it. In addition, the encoding of address information, as well as further enhancement of the steering function in Index.asp, introduce various encryption to various encryption, introduce various encrypted encryption The mechanism can also achieve the purpose of hiding the real page. As me, I just introduce these simplest things. If you want to use it, naturally you need to add bricks.