开发者

easy way to show images in asp.net from ftp server?

is there any easy way to show images in asp.net page from a 开发者_JAVA百科ftp server?


If your password is secure then follow below steps :-

You really should create an FTP account that only has access to the folder with the images on your FTP server. Do that as soon as possible.

For a better overall solution, either synchronize the images to your webserver, or write an HTTP handler that will fetch the image server-side and streams the bytes to the client as if the image was on your server. Have a look at System.Net.FtpWebRequest for the second solution.

If you have write access to disk on the web server, you could implement both parts of the solution. So if an image is fetched the first time, write it to disk before sending it to the client. The next time it's requested, simply redirect the request to the image on disk (or dynamically change the URL of the tag for that product). This way, you build a cache of the images on your web server as time passes. Of course, you need to be able to invalidate the cache in case an image is updated.


<img src="ftp://..."/>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜