开发者

How to assgin image which outside project

开发者 https://www.devze.com 2023-02-09 12:32 出处:网络
I m trying 开发者_开发问答to assign imageurl like thisImage1.ImageUrl = @\"C:\\abc.jpg\"; my image is outside the project but it not working.how we can assign image which is outside

I m trying 开发者_开发问答to assign imageurl like this Image1.ImageUrl = @"C:\abc.jpg";

my image is outside the project but it not working. how we can assign image which is outside

the project.Is their any changes in config file for do that?


Asp.net works on IIS. IIS processes user request over HTTP to resolve some content. So when you assign ImageUrl = @"C:\abc.jpg" IIS cannot resolve this over HTTP spec (at least at security reason, because anybody then could ask file from your computer).

To solve you problem - just create yet another IIS web-application, (that can be mounted at any folder of disk), assuming it is called MyImages. After it you can reference to ImageUrl = @"http://MyImages/abc.jpg"

The better way is placing images onto Content Delivery Network (CDN) - public servers that shares picture for anybody in fast way

0

精彩评论

暂无评论...
验证码 换一张
取 消