Why does HttpCacheability.Private suppress ETags?

前端 未结 3 1650
天命终不由人
天命终不由人 2020-12-30 22:36

While writing a custom IHttpHandler I came across a behavior that I didn\'t expect concerning the HttpCachePolicy object.

My handler calculates and sets an entity-ta

3条回答
  •  一整个雨季
    2020-12-30 23:27

    If like me you're unhappy with the workaround mentioned here of using Cacheability.ServerAndPrivate, and you really want to use Private instead - perhaps because you are customising pages individually for users and it makes no sense to cache on the server - then at least in .NET 3.5 you can set ETag through Response.Headers.Add and this works fine.

    N.B. if you do this you have to implement the comparison of the client headers yourself and the HTTP 304 response handling - not sure if .NET takes care of this for you under normal circumstances.

提交回复
热议问题