The method of ASP pseudo-static and the discussion of ASP static

Source: Internet
Author: User
Tags create directory servervariables
ASP page if you want to make it look static, not completely static, the goal is to make it more friendly to the search engine. Please, as a hard webmaster are not too. You can use this method. such as the list.asp?id=1 path can be converted to html/?1.html,list.asp?id=1&id2=2 conversion to html/?1-2.html and so on.

For example, we need to convert the URL form "/list.asp?a=3&b=8" to "/html/?3-8.html".

Methods: Create directory HTML, and in HTML, place a system default home file, such as Default.asp, and write the following code in Default.asp:

<%
Dim id,id1,id2,a,b
Id=request.servervariables ("Query_string")

Id1=replace (ID, ". html", "")
Id2=split (ID1, "-")

A=id2 (0)
B=id2 (1)
Response.Write "A parameter value is:" &a& "<br>b parameter value is:" &b
"Here you've got the A and B parameters for the list.asp file."
"Use this parameter to open the database as before and get the content.
%>

The principle is simple. is to use Request.ServerVariables ("query_string") to obtain the received value (?), such as/html/?3-8. HTML to receive is 3-8.html, filter 3-8.html, we only need to get parameters 3 and 8, according to 3 and 8 to retrieve data from the database, followed by the same as the dynamic ASP.



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.