현재 URL정보, path 정보 등등 ServerVariables
오늘은 디버깅할 때나 현재 페이지 url 알고자 할 때 많이 사용하는 ServerVariables 의 인자들에 대해 몇가지 설명하고자 합니다.
많이 알고는 있는 정보지만 한번 모아보았습니다.
* 소스코드
' 현재 url의 서버상의 path 정보
serverMapPath = Server.MapPath(".")
' 현재 url의 서버상의 path 정보 - 가상path의 경우 실제 있는 path을 알고자 때 사용
physicalPath = Request.ServerVariables("appl_physical_Path")
' ?? 잘 기억이~
filePath = Request.ServerVariables("path_translated")
' 도메인
serverName = Request.ServerVariables("server_name")
' 포트
serverPort = Request.ServerVariables("server_port")
' 현재 location.href url
urlPath = Request.ServerVariables("path_info")
' get 인자
urlQuery = Request.ServerVariables("query_string")
' 실제 호출된 url 을 만들어봄
if Len(urlQuery) > 0 then
urlFull = "http://" & serverName & ":" & serverPort & urlPath & "?" & urlQuery
else
urlFull = "http://" & serverName & ":" & serverPort & urlPath
end if
사용법은 다로 안알려드려도 될 것 같네요. 그냥 필요한 함수 사용하시면 됩니다.
#ASP#path#query#servervariables#url#urlPath