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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM