Relative path from site root

后端 未结 2 1126
名媛妹妹
名媛妹妹 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.

提交回复
热议问题