ASP code shows absolute path

Source: Internet
Author: User
Tags format servervariables to domain
Show

<%
  "to root path format
 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
& nbsp; ' Root path to domain full path format
 dim shost, sport
 shost = Split (Request.ServerVariables ("Server_protocol"), "/ ") (0) &"://"& Request.ServerVariables (" Http_host ")
 sport = Request.ServerVariables (" Server_port ")
 if Sport <> Then
  shost = shost & ":" & Sport
 end If
 rootpat H2domainpath = shost & URL
 %>
<%=rootpath2domainpath%><%=relativepath2rootpath%>







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.