Web Api 返回一个页面 或者直接跳转到指定页面
一、返回页面
string uri = "http://localhost:19432/Home/WeiZhanHomePage?templateID=T0019";
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;
二、跳转指定路径
HttpResponseMessage resp = new HttpResponseMessage(HttpStatusCode.Moved);
resp.Headers.Location = new Uri(uri);
return resp;

浙公网安备 33010602011771号