I return HTML content and display in excel file in ASP.NET MVC.
My question is about img source.Img source does not work.
My Code:
public ActionResult ExportData()
{
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=test.xls;");
var stringWrite = new StringWriter();
var htmlWrite = new HtmlTextWriter(stringWrite);
var headerTable = @"<Table><tr><td><img src=""C:\Users\xx\Desktop\Export\Export\Images\orderedList0.png"" \></td></tr></Table>";
Response.Write(headerTable);
Response.Write(stringWrite.ToString());
Response.End();
return RedirectToAction("StudentDetails");
}
Above code exports excell file without problem. I only have problem about displaying image. Image can not appear exactly. There is a problem about img source.
What is the correct way for img src for my code?