HttpCachePolicy SetETag

六月ゝ 毕业季﹏ 提交于 2019-12-12 04:58:51

问题


http://msdn.microsoft.com/en-us/library/system.web.httpcachepolicy.setetag.aspx

Is there a way to check for is the ETag is already set? I Keep getting the exception

The ETag header has already been set

But i can figure out how to check for it


回答1:


You can check the response headers for it. For example in a ActionResult

    public override void ExecuteResult(ControllerContext context)
    {
        if (_etag != null && context.HttpContext.Response.Headers["ETag"] == null)
        {
            context.HttpContext.Response.AddHeader("ETag", _etag);
        }
    }


来源:https://stackoverflow.com/questions/10347488/httpcachepolicy-setetag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!