在ASP.Net WebApi 中如何返回页面呢?下面的代码给出来答案

 [HttpGet]
        public HttpResponseMessage  Report([FromBody] InspectionReportArgs args)
        {
            string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Reports", "CheckItem.html");
            string html = File.ReadAllText(path, Encoding.UTF8);

            var baseInfo = _checkItemService.GetCheckBase(args.lsh);

            RenderContext renderContext = new RenderContext();

            renderContext.Add(items);
            renderContext.Add(baseInfo);

            html = ReplaceStringVar(html, renderContext);

           var result = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(html, Encoding.UTF8, "text/html")
            };
            return result;

        }

以上的部分代码实现的是从数据库找到模块中特定值替换。