0

Does anybody know if it possible to cache the image from the database?

I know that there is an OutputCache attribute for above the Action. You then could set the VaryByParam to the id of the image in the database. But this would just save the image on the server and not on the client right?

I was hoping that er was something as a expiration header for an image. Can you add that to an image? In that way, the client is responsible for the request to the server. This saves a request to the server...

If i'm wrong, please correct me because i'm new in this kind (OutputCache and Expiration Headers) of caching.

Thanks

LockTar
  • 5,364
  • 3
  • 46
  • 72

1 Answers1

0

Output caching affects the client's caching as well so this will actually work ok for you. See my note on caching here: Disable browser cache for entire ASP.NET website

Someone on that thread thought that output caching was only on the server side as well but a quick test can tell you otherwise. This doesn't mean there aren't scenarios where its limited to the server (such as varying by key). I would have one action method responsible for only serving up these files. That method doesn't need to cache by key, just change your Duration to say a minute and watch your headers coming down in Fiddler to verify.

Community
  • 1
  • 1
Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71