9
ASP.NET Web APIでダウンロードファイル名を設定する方法
私のApiControllerクラスには、サーバーによって作成されたファイルをダウンロードするための次のメソッドがあります。 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 …
140
c#
asp.net-web-api