title: How to set downloading file name in ASP.NET Web API
body: <p>In my ApiController class, I have following method to download a file created by server.</p>
  
  <pre><code>public HttpResponseMessage Get(int id)
  {
      try
      {
          string dir = HttpContext.Current.Server.MapPath("~"); //location of the template file
          Stream file = new MemoryStream();
          Stream result = _service.GetMyForm(id, dir, file);
          if (result == null)
          {
              return Request.CreateResponse(HttpStatusCode.NotFound);
          }
          result.Position = 0;
          HttpResponseMessage response = new HttpResponseMessage();
          response.StatusCode = HttpStatusCode.OK;
          response.Content = new StreamContent(result);
          return response;
      }
      catch (IOException)
      {
          return Request.CreateResponse(HttpStatusCode.InternalServerError);
      }
  }
  </code></pre>
  
  <p>Everything is working perfect except that default downloading file name is its id so user might have to type his/her own file name at save as dialog each time. Is there any way to set a default file name in the code above?</p>