asp获取当前页地址,当前文件名的函数

<%

Function GetLocationURL()
Dim Url
Dim ServerPort,ServerName,ScriptName,QueryString
ServerName = Request.ServerVariables("SERVER_NAME")
ServerPort = Request.ServerVariables("SERVER_PORT")
ScriptName = Request.ServerVariables("SCRIPT_NAME")
QueryString = Request.ServerVariables("QUERY_STRING")
Url="http://"&ServerName
If ServerPort <> "80" Then Url = Url & ":" & ServerPort
Url=Url&ScriptName
If QueryString <>"" Then Url=Url&"?"& QueryString
GetLocationURL=Url
End Function

Response.Write GetLocationURL()

%>

利用函数InstrRev()获取当前文件名

<%
Dim aa,bb,cc,dd
aa=Request.Servervariables("url")
bb=InstrRev(aa,"/")
cc=len(aa)
dd=Right(aa,cc-bb)
Response.Write dd
%>

本博客所有文章如无特别注明均为原创。作者:sysdee复制或转载请以超链接形式注明转自 成功志
原文地址《asp获取当前页地址,当前文件名的函数
分享到:更多

相关推荐

发表评论

路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交

网友评论(0)