server| Blog | link
A permanent link can be seen in the tail of many blog posts. This link is generally lasting, even if the blog program changed, you can use this link to access the original log, and will not find the situation of the page, which is a blog is indeed a more practical function.
In the modification of the blog program, also considered this issue, and decided to add a permanent link to the blog log function.
IIS6 If you request a directory to keep up with the parameters, you will pass this parameter to the default document, that is, if you request my blog home http://www.xujiwei.cn/blog/?id=500, then id= 500 will be passed to the default document Default.asp. Use this to achieve a permanent link to the blog log. Of course, this permanent link is based on the blog directory does not change the situation, if the directory changed, you need to deal with another.
Response.Redirect can be used in ASP, the principle is that the server sends a 302 Object moved response to the client, then the client turns to the response, but this adds extra bandwidth overhead and does not use the search engine to So it is recommended to use Server.Transfer to turn. Server.Transfer simply stops the execution of the current script, executes the specified script, and some of the current variables, such as sessions, can be used directly in the new script, without having to pass the argument again, and Response.Redirect not.
Another obvious difference between the two approaches is that the URLs that are displayed with the Response.Redirect client will change, and Server.Transfer will not, and the client will not feel that the current URL has actually changed when using Server.Transfer. In fact, this difference can also be seen through the invocation of two methods, one is Response.Redirect by the client to make changes, and Server.Transfer is the server to make changes.
Understand these can begin to do, open the default document of the blog, is generally the homepage of the blog program, such as Default.asp, index.asp and so on, and then add the following code before its output content:
<%if request.querystring ("id") Then server.transfer ("article.asp")%>
Of course Article.asp is to be based on the blog program to do the corresponding changes, ID is to do as a permanent link when the parameters, you need to pay attention to this parameter must be article.asp can be recognized, that is, article.asp can be based on this parameter to display the log, if not, we will make the corresponding changes, that is, The parameter name in ASP is changed to ID, or the ID is changed to another name.
OK, finish! In fact, this thing is very simple, such a large space is mostly nonsense, really useful on so a code.