Recommended: Migrating from ASP to ASP -- Initial Considerations (II) Using the same idea as creating a universal connection in a separate module, we create a Pagelet. Pagelet enables developers to create pseudo-controls, which can be used to display properties, methods, and events as well as objects. Our solution is: Create a
Very simple tutorial for friends who like SEO. Replace http://www.***.cn/article.asp?logID=26 with http://www.***.cn/article.asp?/a26.html. There is no need to use iis ISAPI_Rewrite to make url rewrite based on IIS
1. The database is simple to use ACCESS, Data.mdb to create a table Article, with three fields: ID, Title, Content; automatic numbering, title, and article content.
2. Config.asp
ASP/Visual Basic Code
| The following is the quoted content: <% 'Database link db=data.mdb Set conn = Server.CreateObject(ADODB.Connection) connstr=Provider=Microsoft.Jet.OLEDB.4.0;Data Source= & Server.MapPath(db) conn.open connstr If Err Then err.Clear Set conn = Nothing Response.Write There is an error in the database connection, please check the connection string. Response.End End If 'Define the reading of the news reading interface Dim News_title,News_content Sub ReadNews() set rs1=server.createobject(adodb.recordset) sql1=select id,title,content from article where id=& ID rs1.open sql1,conn,3,3 News_title=rs1(title) News_content=rs1(content) rs1.close set rs1=Nothing End Sub %> |
3. Default.asp
The following is the quoted content:
ASP/Visual Basic Code
<!--#include file=config.asp-->
<ol>
<%
Set rs=server.CreateObject(adodb.recordset)
sql=select * from Article
rs.open sql,conn,1,1
do while not rs.eof
%>
<li><a href=article.asp?/<%=rs(id)%>.html><%=left(trim(rs(title)),30)%></a></li>
<%
rs.movenext
loop
rs.close
set rs=Nothing
%>
</ol>
4. Article.asp
ASP/Visual Basic Code
The following is the quoted content: <!--#include file=config.asp--> <% id=request.QueryString(id) If id= Then server_v40=Request.ServerVariables(QUERY_STRING) id=Int(replace(replace(server_v40,/,),.html,)) End If Call ReadNews() %> <div> Title: <b><%= News_title%></b><br /> Content: <%=News_content%> </div> |
Share: How to implement Asp and Asp.Net Share Session In .net, the storage mechanism of Session is different from that of Asp. Although it can run asp and aspx at the same time under the same IIS, Session cannot be passed between them. Previously, a large number of systems were used to asp. During the upgrade process, if the asp is completely abandoned