Using ASP to implement HTTP://XX@XX.XX virtual domain name

Source: Internet
Author: User
To give you my ideas, I hope to some interested friends a little help:

First of all must have their own top-level domain name:-), but also sacrifice their own home index.asp name (for example: "The homepage renamed to Index1.asp, but in the program can be judged without the @ parameters of the domain name and then jump to the home page)."

First, the default first page in the root directory of the domain name index.asp as the get @ before parameter jumps
Index.asp



go.asp processing domain names and implementing jumps
<%'数据库连接,存放用户注册信息,内容为域名,以及域名所指向的具体URL地址,域名访问简单记数,以及一些用户信息%>
<!--#includefile="conn.asp"-->
<%
'获取URL参数
url=request.QueryString("url")
'判断是否是以虚拟@域名形式传递过来
ifinstr(url,"@")=0then
'如果没有则直接跳转到自己的首页index1.asp
response.Redirect("index1.asp")
else
'处理url参数,取得中的username
url=right(url,(len(url)-len("http://")))
url=left(url,(instr(url,"@")-1))
user=url
'从数据库中取出于username对应的转向目标url地址
setrs=conn.execute("selectsiteurlfromurlwhereuser='"&user&"'")
ifrs.boforrs.eofthen
'如果没有记录则显示:该域名不存在
response.Write("<ahref='http://skyworm.com'><fontsize=2><center>该域名不存在</center></font></a>")
else
'对域名访问率简单记数
conn.execute("updateurlsetcount=count+1whereuser='"&user&"'")
'跳转到虚拟域名对应的目标url地址,程序结束!
response.Redirect(rs(0))
endif
rs.close
setrs=nothing
endif
conn.close
setconn=nothing
%>


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.