〖原创〗利用 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" "http://www.w3.org/TR/html4/loose.dtd">
<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
这是一个简单的服务器变量的应用,但很有用哦
页:
[1]