一切福田,不離方寸,從心而覓,感無不通。

WEBAPI 返回一个html页面

public HttpResponseMessage getHtml()
{

string uri = "http://docs.google.com/gview?embedded=true&url=www.pdf995.com/samples/pdf.pdf";

WebClient wc = new WebClient();
Stream resStream = wc.OpenRead(uri);
StreamReader sr = new StreamReader(resStream, System.Text.Encoding.Default);
string ContentHtml = sr.ReadToEnd();
var response = new HttpResponseMessage();
response.Content = new StringContent(ContentHtml);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
return response;
}
————————————————
版权声明:本文为CSDN博主「小咪蜂」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/xiaomifengmaidi1/java/article/details/84665109