经典 ASP - 获取完整的 url 名称 [英] Classic ASP - get full url name

查看:40
本文介绍了经典 ASP - 获取完整的 url 名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以帮助我.

Im wondering if someone could help me.

我有以下网址(它是动态的)

I have the following URL ( which is dynamic )

www.website.com/images/gal/boxes-pic004.asp

如何使用经典 ASP 提取boxes-pic004"部分

How can i extract the 'boxes-pic004' part using classic ASP

谢谢

推荐答案

<%
Dim sScriptLocation, sScriptName, iScriptLength, iLastSlash

sScriptLocation = Request.ServerVariables("URL")
iLastSlash      = InStrRev(sScriptLocation, "/")
iScriptLength   = Len(sScriptLocation)
sScriptName     = Right(sScriptLocation, iScriptLength - iLastSlash)
%>

sScriptName 将包含 boxes-pic004.asp,然后您可以使用 Replace(sScriptName, ".asp", "")也删除扩展名.

sScriptName will then contain boxes-pic004.asp, then you can use Replace(sScriptName, ".asp", "") to remove the extension as well.

这篇关于经典 ASP - 获取完整的 url 名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆