title: How to add header with empty value to the http response (Response.Headers)?
body: <p>I want to integrate my web site with office online by using WOPI protocol. I use asp.net core(3.0) web API to implement WOPI server. According the protocol documentation: <a href="https://wopi.readthedocs.io/projects/wopirest/en/latest/files/Unlock.html" rel="nofollow noreferrer">https://wopi.readthedocs.io/projects/wopirest/en/latest/files/Unlock.html</a> : :</p>
  
  <blockquote>
    <p>Response Headers
            X-WOPI-Lock – A string value identifying the current lock on the file. <strong>This header must always be included when responding to the
    request with 409 Conflict.</strong></p>
  </blockquote>
  
  <p>When file is not locked and I got request to unlock it, I need to response "409 Conflict"
  with header that contains empty value: <strong>X-WOPI-Lock: ""</strong></p>
  
  <p>I tried to use:</p>
  
  <blockquote>
  <pre><code>[ApiController]
  public class filesController : ControllerBase
  {
  
      [HttpPost]
      [Route("wopi/files/{id}")]
      public IActionResult Post(Guid id)
      {
          var result = new StatusCodeResult((int)HttpStatusCode.Conflict);
          HttpContext.Response.Headers.Add("X-WOPI-Lock", string.Empty);
          return result;
      } }
  </code></pre>
  </blockquote>
  
  <p>and look like asp.net core ignore empty header, because it not present on the client, i see it by using Microsoft validation tool for WOPI
  <a href="https://i.stack.imgur.com/JljMT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JljMT.png" alt="enter image description here"></a></p>
  
  <p>If I add some test value to the header, it appeared in the response:</p>
  
  <blockquote>
    <p>HttpContext.Response.Headers.Add("X-WOPI-Lock", "Some value");</p>
  </blockquote>
  
  <p>In the validation tool I see an error:
  <a href="https://i.stack.imgur.com/a4Axu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a4Axu.png" alt="enter image description here"></a></p>
  
  <p>Look like, I need to create a http response that contains a header with empty value : <strong>X-WOPI-Lock: ""</strong>. </p>
  
  <p>How can I do this?</p>