怎么检测是wap或者web访问
我想做个站点,进去时检测是什么类型访问,若是WAP转去wap/index.asp网页,若是web访问转去web/index.asp谁能给个代码...
我想做个站点,进去时检测是什么类型访问,若是WAP转去wap/index.asp网页,若是web访问转去web/index.asp谁能给个代码
展开
2个回答
展开全部
<%
rpath="http://"&Request.ServerVariables("HTTP_HOST")&"/"
dim agent,str,siteid,tourl
agent=request.ServerVariables("HTTP_USER_AGENT")
if instr(agent,"Mozilla")=0 then
tourl= "wapindex.asp" 'WAP page
toWML()
else
str=agent
str=replace(str,"Opera","")
str=replace(str,"SmartPhone","")
str=replace(str,"CE","")
str=replace(str,"UC","")
str=replace(str,"Symbian","")
str=replace(str,"NetFront","")
if Len(agent)=Len(str) then
response.redirect "web/index.asp" 'admin
else
tourl= "wap/index.asp" 'WAP page
toWML()
end if
end if
sub toWML()
response.redirect rpath&tourl
response.end
end sub%>
rpath="http://"&Request.ServerVariables("HTTP_HOST")&"/"
dim agent,str,siteid,tourl
agent=request.ServerVariables("HTTP_USER_AGENT")
if instr(agent,"Mozilla")=0 then
tourl= "wapindex.asp" 'WAP page
toWML()
else
str=agent
str=replace(str,"Opera","")
str=replace(str,"SmartPhone","")
str=replace(str,"CE","")
str=replace(str,"UC","")
str=replace(str,"Symbian","")
str=replace(str,"NetFront","")
if Len(agent)=Len(str) then
response.redirect "web/index.asp" 'admin
else
tourl= "wap/index.asp" 'WAP page
toWML()
end if
end if
sub toWML()
response.redirect rpath&tourl
response.end
end sub%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询