Properly respond to a HEAD request
I have an IHttpHandler
serving dynamically generated files. I wish to respond to HEAD
requests to let the client know whether the file has c开发者_开发百科hanged.
I need to send the last change date and the file size, do I have to use Response.AddHeader()
or is there a cleaner way?
For the last modified time, you can call:
Response.Cache.SetLastModified()
Are you sure you need to set the size? The Framework usually takes care of that automatically, based on the actual size of the response.
精彩评论