My Current code is below, which only downloads the files. How to view all files types in a browser?
[HttpGet]
//[NoCacheHeader()]
[Route("api/image/files")]
public HttpResponseMessage GFiles(string ImageName)
{
var response = Request.CreateResponse(HttpStatusCode.OK);
var path = "~/Image/" + ImageName;
path = System.Web.Hosting.HostingEnvironment.MapPath(path);
var ext = System.IO.Path.GetExtension(path);
var contents = System.IO.File.ReadAllBytes(path);
System.IO.MemoryStream ms = new System.IO.MemoryStream(contents);
response.Content = new StreamContent(ms);
//
response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
response.Content.Headers.ContentDisposition.FileName = ImageName;
//
response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("Image/" + ext);
return response;
}