Streaming Databased Images Using HttpHandler

前端 未结 3 1905
深忆病人
深忆病人 2020-11-28 14:51

For a long time now I have noticed something annoying when working on Web Application projects involving databased images on my local machine. By local I mean that it\'s a t

3条回答
  •  渐次进展
    2020-11-28 15:16

    If you are serving images directly, do not forget to set the correct caching headers, i.e. etags and expires. If you don't you are really going to hit your database hard and use up your bandwidth.

    You will need to handle the following http headers:

    • ETag
    • Expires
    • Last-Modified
    • If-Match
    • If-None-Match
    • If-Modified-Since
    • If-Unmodified-Since
    • Unless-Modified-Since

    For an example http handler that does this check out: http://code.google.com/p/talifun-web/wiki/StaticFileHandler

提交回复
热议问题