asp获取当前页地址,当前文件名的函数
成功志
asp获取当前页地址,当前文件名的函数
2011-12-30 ok12

<%


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

%>

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容