Show Images from outside of ASP.NET Application

后端 未结 2 1501
陌清茗
陌清茗 2020-12-10 21:58

So I\'m having some trouble displaying images from outside of the project folder...

I seem to be only able to access images within the \"~\" directory and subdirecto

2条回答
  •  醉酒成梦
    2020-12-10 22:23

    The client browser will never know where those images are unless you map a virtual directory to the images. On your local test environment, you could work around this by referencing the image as "file:///E:/XYZ/11-01-01 New Year/myimage.jpg", but this is EXTREMELY bad practice and will never work in a production environment. You should always use relative paths within the application's working directory, or a statically defined virtual directory located elsewhere.

提交回复
热议问题