html5中文学习网

您的位置: 首页 > 网络编程 > ASP编程 » 正文

asp代码 显示绝对路径_ASP教程_编程技术

[ ] 已经帮助:人解决问题
显示

<%
 ' 转为根路径格式
 Dim sTempUrl
 sTempUrl = url
 If Left(sTempUrl, 1) = "/" Then
  RelativePath2RootPath = sTempUrl
 End If
 Dim sWebEditorPath
 sWebEditorPath = Request.ServerVariables("SCRIPT_NAME")
 sWebEditorPath = Left(sWebEditorPath, InstrRev(sWebEditorPath, "/") - 1)
 Do While Left(sTempUrl, 3) = "../"
  sTempUrl = Mid(sTempUrl, 4)
  sWebEditorPath = Left(sWebEditorPath, InstrRev(sWebEditorPath, "/") - 1)
 Loop
 RelativePath2RootPath = sWebEditorPath & "/" & sTempUrl
 ' 根路径转为带域名全路径格式
 Dim sHost, sPort
 sHost = Split(Request.ServerVariables("SERVER_PROTOCOL"), "/")(0) & "://" & Request.ServerVariables("HTTP_HOST")
 sPort = Request.ServerVariables("SERVER_PORT")
 If sPort <> "80" Then
  sHost = sHost & ":" & sPort
 End If
 RootPath2DomainPath = sHost & url
 %>
<%=RootPath2DomainPath%><%=RelativePath2RootPath%>

4CzHTML5中文学习网 - HTML5先行者学习网
4CzHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助