当前位置: 首页 > 图文教程 > 网络编程 > ASP > 多个绑定多域名的ASP代码

ASP
生成像资源管理器一样的树形目录
将连接数据库的代码隐藏在DLL中
ASP中从数据库读取二进制文件数据代码
asp查询xml的代码,实现了无刷新、模糊查询功能
一个asp函数, 解决SQL Injection漏洞
在ASP中利用COM组件开发Web应用程序
关于如何利用COM+,来提高ASP执行权限的问题!
升级MD5.ASP,打造完全动态不重复的安全加密代码
ASP安全检测与过滤函数SafeCheck
在ASP中,用JScript脚本实现分页的另类办法
查看服务器Application/Session变量工具
自己写的一个简单ASP调用存储过程查询
ASP登陆验证页应做的安全问题
使用ASP与javascript配合实现多个复选框数据关联显示
Windows 2003下不注册组件用ASP发邮件
数据分页方法新思路,速度非常快!
ASP程序中同一个用户不允许同时登陆两次
分栏显示记录集的表格演示,并实现了分页
关于Adodb.Stream的写数据库数据到客户端文件的实践
将ASP的Debug变得简单的两个函数

多个绑定多域名的ASP代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 135 ::
收藏到网摘: n/a

第一种方法:

如果有有一个ASP空间,而你又想放置多个多个站点,这些代码可以帮到你:

以下为引用的内容:
第一个
<%if Request.ServerVariables("SERVER_NAME")="www.netbei.com" then
response.redirect "zkj"
else
response.redirect "i.htm"
end if%>

第二个
<%
select case request.servervariables("http_host")
case "www.netbei.com" '1
Server.Transfer("v3.htm")
case "www.aspcn.net" '2
Server.Transfer("i.htm")
case "www.netbei.cn" '3
Server.Transfer("netbei.htm")
...... 继续添加 ......
end select
%>

第三个
<%if instr(Request.ServerVariables
("SERVER_NAME"),"kekexi.com")>0 then
response.redirect "index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"4668.com")>0 then
response.redirect "x/index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"web315.com")>0 thenr
esponse.redirect "index3.asp"
end if
end if
end if%>

第四个
<%if Request.ServerVariables("SERVER_NAME")="www.netbei.com" then
response.redirect "index1.asp"
else if Request.ServerVariables("SERVER_NAME")="www.ce.org.cn" then
response.redirect "index2.asp"
else if Request.ServerVariables("SERVER_NAME")="www.163.com" then
response.redirect "index3.asp"
end if
end if
end if%>

以下为引用的内容:

第二种方法:


<%
dim domainname,result
domainname=Request.ServerVariables("SERVER_NAME")
result=right(domainname,12)
if result="my.netbei.com" then
%>
<!--#include file=mynetbei.asp -->
<%
Elseif result="rtisancn.com" then
%>
<!--#include file=artisan.asp -->
<%
Elseif result="gn.netbei.com" then
%>
<!--#include file=web.asp -->
<%
Elseif result=".forwest.com" then
%>
<!--#include file=forwest_com.asp -->
<%
Else
%>
<!--#include file=netbei.asp -->
<%
End if
%>