I used to write a website building system that automatically generates websites. But recently I have to write a system that does not automatically generate websites, but does the following:
http://www.downcodes.com/Username So I want one user to create a directory. But I think if there are W users, then I don’t want to create W directories.
So I used the 404 error of IIS and analyzed the error message to write an automatic redirection code.
First point all 404 errors in IIS to: URL:/website.asp?webname=$V
and then create one under the root directory of the website:
website.asp
'-----------------The content is as follows------------------'
<%@ codepage ="936" %>
<!--#include file="conn/dbconn.asp"-->
<%
WebName=trim(Request.QueryString("WebName"))
WebName=right(WebName,len(WebName)-Instr(WebName,"80")-2)
Set rs = Conn.Execute("Select ID from Qyml where User='"&WebName&"'")
if rs.eof then
Response.write("File not found!")
Else
Response.redirect("/show/index.asp?id="&rs("ID"))
end if
%>
'------------------------------------------------'
OK, it’s fully implemented, no need to create N multiple directories.