Relative path from site root

后端 未结 2 1119
名媛妹妹
名媛妹妹 2021-01-27 06:50

I feel like a nub for asking this, but I can\'t figure it out.. I\'ve found several posts (here\'s one) saying that to use a relative path from the root of your site, start the

相关标签:
2条回答
  • 2021-01-27 07:01

    The relative paths work because they are traversing the directory based on the location, so for index.aspx it needs to go into images folder and get the img1.jpg, for test.aspx it needs to go up one level .. then into the images folder and get the img1.jpg.

    Absolute paths are based off of were the application is installed from based on IIS settings. If you are just testing this from that folder your absolute path needs to include the root folder. /root/images/img1.jpg and then it will work from both test and index with the same absolute path.

    0 讨论(0)
  • 2021-01-27 07:08

    Your site is probably in a virtual directory, so the "/" refers to the actual web root as IIS (or whatever web server) sees it - maybe the folder above your 'root' folder

    .

    0 讨论(0)
提交回复
热议问题