0

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

mimo
  • 937
  • 12
  • 19

1 Answers1

0

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);
        }
    }
Shawn C.
  • 6,446
  • 3
  • 34
  • 38
  • Dont you have to add ETags like this? HttpContext.Current.Response.Cache.SetETag("") – mimo Apr 30 '12 at 13:57