精美而实用的网站,关注web编程技术、网站运营、SEO推广,让您轻松愉快的学习

ASP得到当前页面的URL字符串,当处理完一个操作后,可以用本函数获取自己本身所在页面的URL,然后自动返回到本页,这样即使你修改文件名的话,也不受影响。

ASP获取当前页面URL函数

<%
Function CUrl()
Domain_Name = LCase(Request.ServerVariables("Server_Name"))
Page_Name = LCase(Request.ServerVariables("Script_Name"))
Quary_Name = LCase(Request.ServerVariables("Quary_String"))
  If Quary_Name ="" Then
   CUrl = "http://"&Domain_Name&Page_Name'若不需要域名网址可自行去掉
  Else
   CUrl = "http://"&Domain_Name&Page_Name&"?"&Quary_Name
  End If
End Function
%>

函数将返回CUrl的变量值,如果不需要域名,在CUrl中可去掉Domain_Name变量。

Tags:ASP URL 函数