정적 및 동적 파일에서 상대 URL과 절대 URL 주소를 사용하는 방법을 완전히 이해하고 싶습니다.웹 사이트 루트 (절대/상대 URL)의 기본 URL 얻기
~ :
/:
.. : in a relative URL indicates the parent directory
. : refers to the current directory
/: always replaces the entire pathname of the base URL
// : always replaces everything from the hostname onwards
가상 디렉터리없이 작업 할 때이 예제는 쉽습니다. 하지만 난 가상 디렉터리에서 일하고 있습니다.
Relative URI Absolute URI
about.html http://WebReference.com/html/about.html
tutorial1/ http://WebReference.com/html/tutorial1/
tutorial1/2.html http://WebReference.com/html/tutorial1/2.html
/ http://WebReference.com/
//www.internet.com/ http://www.internet.com/
/experts/ http://WebReference.com/experts/
../ http://WebReference.com/
../experts/ http://WebReference.com/experts/
../../../ http://WebReference.com/
./ http://WebReference.com/html/
./about.html http://WebReference.com/html/about.html
가상 디렉토리에서 작업하는 프로젝트처럼 아래 사이트를 시뮬레이션하고 싶습니다.
이 내 영문 및 ASCX 폴더입니다
http://hostAddress:port/virtualDirectory/MainSite/ASPX/default.aspx
http://hostAddress:port/virtualDirectory/MainSite/ASCX/UserCtrl/login.ascx
http://hostAddress:port/virtualDirectory/AdminSite/ASPX/ASCX/default.aspx
이 내 JS 파일 (영문 및 ASCX 파일을 모두 사용 될)은 다음이 내 정적 웹 페이지
http://hostAddress:port/virtualDirectory/MainSite/JavascriptFolder/jsFile.js
http://hostAddress:port/virtualDirectory/AdminSite/JavascriptFolder/jsFile.js
입니다
주소 (일부 사진을 보여주고 일부 js 기능을 실행하고 싶음) :http://hostAddress:port/virtualDirectory/HTMLFiles/page.html
이것은 내 이미지 접기입니다. 어
http://hostAddress:port/virtualDirectory/Images/PNG/arrow.png
http://hostAddress:port/virtualDirectory/Images/GIF/arrow.png
내가 쓰는 내 ASPX 파일에 이미지 파일의 링크가 난
aspxImgCtrl.ImageUrl = Server.MapPath("~")+"/Images/GIF/arrow.png";
를 작성해야하지만 원한다면 내가 경로 하드 코딩이나 자바 스크립트 파일을 작성하려면 URL의 종류 주소가 있어야합니까?