Hi All,
i want to return html code from web api
i have done
public HttpResponseMessage Get()
{
string Filepath = HttpContext.Current.Request.MapPath(@"~/Template1/Receipt1.html");
string Html = File.ReadAllText(Filepath);
StringBuilder sb = new StringBuilder(Html);
var response = new HttpResponseMessage();
response.Content = new StringContent(sb.ToString());
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
response.ReasonPhrase = "success";
return response;
}
above is working fine but i want to use IHttpActionResult
public IHttpActionResult Get()
{
string Filepath = HttpContext.Current.Request.MapPath(@"~/Template1/Receipt1.html");
string Html = File.ReadAllText(Filepath);
StringBuilder sb = new StringBuilder(Html);
// what code should i write here
return Ok();
}

Rajeesh MenothPosted Mar 19, 2019, 4:00 AM
Puneet KankarPosted Mar 18, 2019, 6:34 AM
Madan ShekarPosted Mar 18, 2019, 6:26 AM
Ravi PatelPosted Mar 18, 2019, 6:23 AM
Madan ShekarPosted Mar 18, 2019, 6:12 AM