我想知道是否有人可以帮助我.
我有以下网址(动态)
www.website.com/images/gal/boxes-pic004.asp
Run Code Online (Sandbox Code Playgroud)
如何使用经典ASP提取'boxes-pic004'部分
谢谢
<%
Dim sScriptLocation, sScriptName, iScriptLength, iLastSlash
sScriptLocation = Request.ServerVariables("URL")
iLastSlash = InStrRev(sScriptLocation, "/")
iScriptLength = Len(sScriptLocation)
sScriptName = Right(sScriptLocation, iScriptLength - iLastSlash)
%>
Run Code Online (Sandbox Code Playgroud)
sScriptName然后将包含boxes-pic004.asp,然后您也可以使用Replace(sScriptName, ".asp", "")删除扩展名.
只是你可以尝试输出所有ServerVariables,如,
例如,网页网址: https ://www.google.com/gmail/inbox.asp?uid = 1421 &skyid = 2823595
Dim strProtocol
Dim strDomain
Dim strPath
Dim strQueryString
Dim strFullUrl
If lcase(Request.ServerVariables("HTTPS")) = "on" Then
strProtocol = "https"
Else
strProtocol = "http"
End If
strDomain= Request.ServerVariables("SERVER_NAME")
strPath= Request.ServerVariables("SCRIPT_NAME")
strQueryString= Request.ServerVariables("QUERY_STRING")
strFullUrl = strProtocol & "://" & strDomain & strPath
If Len(strQueryString) > 0 Then
strFullUrl = strFullUrl & "?" & strQueryString
End If
Response.Write "Domain : " & strDomain & "</br>"
Response.Write "Path : " & strPath & "</br>"
Response.Write "QueryString : " & strQueryString & "</br>"
Response.Write "FullUrl : " & strFullUrl & "</br>"
Run Code Online (Sandbox Code Playgroud)
输出:
Domain : www.google.com
Path : /gmail/inbox.asp
QueryString : uid=1421&skyid=2823595
FullUrl : https://www.google.com/gmail/inbox.asp?uid=1421&skyid=2823595
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27140 次 |
| 最近记录: |