title: How to return html page from WebApi action?
body: <p>I'm looking for a WebApi example where the default route will return a given html page to the caller.  I've got the route and action set up as follows.  I just want to send him the index.html page, not redirect, because he's in the right place.</p>
  
  <pre><code>http://localhost/Site      // load index.html
  
  // WebApiConfig.cs
  config.Routes.MapHttpRoute(
      name: "Root",
      routeTemplate: "",
      defaults: new { controller = "Request", action = "Index" }
  );
  
  // RequestControlller.cs
      [HttpGet]
  [ActionName("Index")]
  public HttpResponseMessage Index()
  {
      return Request.CreateResponse(HttpStatusCode.OK, "serve up index.html");
  }
  </code></pre>
  
  <p>If I"m using this wrong, what's the better approach and can you point me to an example?</p>
  
  <p>WebApi 2 with .NET 4.52</p>
  
  <p>Edit:  Hmm, improved it, but getting json header back instead of page content.</p>
  
  <pre><code>public HttpResponseMessage Index()
  {
      var path = HttpContext.Current.Server.MapPath("~/index.html");
      var content = new StringContent(File.ReadAllText(path), Encoding.UTF8, "text/html");
      return Request.CreateResponse(HttpStatusCode.OK, content);
  }
  
  {"Headers":[{"Key":"Content-Type","Value":["text/html; charset=utf-8"]}]}
  </code></pre>