碧海潮声大学生网
标题:
〖原创〗利用 asp服务器变量取得当前URL
[打印本页]
作者:
笨笨啊
时间:
2005-10-13 21:03
标题:
〖原创〗利用 asp服务器变量取得当前URL
有时候为了转向是非常有用的。
用此代码可以取得当前访问这个页面的URL
dim url
url="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("PATH_INFO")
复制代码
这样取得的url便是完整的URL了
完整代码如下
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[url]http://www.w3.org/TR/html4/loose.dtd[/url]">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%
dim url
url="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("PATH_INFO")
response.Write(url)
%>
</body>
</html>
复制代码
这样,便 取得了完整地址
http://localhost/test.asp
复制代码
这是一个简单的服务器变量的应用,但很有用哦
欢迎光临 碧海潮声大学生网 (http://www.zjoubbs.com/)
Powered by Discuz! X3.2