开发者

Properly respond to a HEAD request

开发者 https://www.devze.com 2023-03-07 03:56 出处:网络
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 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.

0

精彩评论

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