asp.net webapi自定义输出结果类似Response.Write()

asp.net webapi自定义输出结果类似Response.Write()
 
[HttpGet]
public HttpResponseMessage HelloWorld()
{
string result = “Hello world! Time is: ” + DateTime.Now;
var resp = new HttpResponseMessage(HttpStatusCode.OK);
resp.Content = new StringContent(result, System.Text.Encoding.UTF8, “text/plain”);
return resp;
}

原文链接:https://www.wangdongjie.com/asp-net-webapi%e8%87%aa%e5%ae%9a%e4%b9%89%e8%be%93%e5%87%ba%e7%bb%93%e6%9e%9c%e7%b1%bb%e4%bc%bcresponse-write.html

 

转载于:https://www.cnblogs.com/wangdongjie0101/p/11537857.html

你可能感兴趣的:(asp.net webapi自定义输出结果类似Response.Write())