[Reverse] simple ASP pseudo Static Page tutorial

Source: Internet
Author: User
Http://www.anace.cn/article.asp? /A73.html

The original intention of writing this tutorial has already been clearly stated in the homepage abstract. Now, we can start.
1. The database uses ACCESS. Data. mdb creates a table Article with three fields: ID, Title, and Content; automatic number, Title, and Article Content.
Ii. Config. asp

ASP/Visual Basic Code
  1. <%
  2. 'Database Link
  3. Db = "data. mdb"
  4. Set conn = Server. CreateObject ("ADODB. Connection ")
  5. Connstr = "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & Server. MapPath (db)
  6. Conn. open connstr
  7. If Err Then
  8. Err. Clear
  9. Set conn = Nothing
  10. Response. Write "database connection error. Check the connection string. "
  11. Response. End
  12. End If
  13. 'Define the reading of the news reading Interface
  14. Dim News_title, News_content
  15. Sub ReadNews ()
  16. Set rs1 = server. createobject ("adodb. recordset ")
  17. Sql1 = "select id, title, content from article where id =" & ID
  18. Rs1.open sql1, conn, 3, 3
  19. News_title = rs1 ("title ")
  20. News_content = rs1 ("content ")
  21. Rs1.close
  22. Set rs1 = Nothing
  23. End Sub
  24. %>

Iii. Default. asp

ASP/Visual Basic Code
  1. <! -- # Include file = "config. asp" -->
  2. <Ol>
  3. <%
  4. Set rs = server. CreateObject ("adodb. recordset ")
  5. SQL = "select * from Article"
  6. Rs. open SQL, conn, 1, 1
  7. Do while not rs. eof
  8. %>
  9. <Li> <a href = "article. asp? /<% = Rs ("id") %>. html "> <% = left (trim (rs (" title "), 30) %> </a> </li>
  10. <%
  11. Rs. movenext
  12. Loop
  13. Rs. close
  14. Set rs = Nothing
  15. %>
  16. </Ol>

IV. Article. asp

ASP/Visual Basic Code
  1. <! -- # Include file = "config. asp" -->
  2. <%
  3. Id = request. QueryString ("id ")
  4. If id = "" Then
  5. Server_v40 = Request. ServerVariables ("QUERY_STRING ")
  6. Id = Int (replace (server_v40, "/", ""), ". html ",""))
  7. End If
  8. Call ReadNews ()
  9. %>
  10. <Div>
  11. Title: <B> <% = News_title %> </B> <br/>
  12. Content: <% = News_content %>
  13. </Div>

This tutorial has been able to implement the most basic functions. For details, you can see how to apply them!

-------------------------------------------------
I personally think that this search engine optimization has become more complicated. Does a search engine think it has? The link is friendly, so it is a waste of time to draw a snake .. This is also pseudo-friendly. It's just a habit for people.
In addition, I think asp does not consider the pseudo-static aspect. A large search engine is also trying to collect its own data, so they will do their best in dynamic links.

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.