I have a tab on my page, when i click on this tab, i need to show a pdf file on page(browser). For this i am writing function on control like this
public ActionResult PricedPdf(string projID,string fileName)
{
byte[] bArr = new byte[] { };
bArr = getdata();
return File(bArr, System.Net.Mime.MediaTypeNames.Application.Pdf, fileName+".pdf");
}
Now my problem is when i render this, page only show some unreadable data not pdf.
May be the problem is due to jquery tab, I am using Jquery tab
I used this in place of File, but still showing same problem
public ActionResult PricedPdf(string projID, string fileName)
{
byte[] bArr = new byte[] { };
bArr = getdata();
Response.AddHeader("Content-disposition", "inline; filename=\"" + fileName + "\"");
Response.ContentType = "application/" + System.IO.Path.GetExtension(fileName).Replace(".", "");
Response.BinaryWrite(bArr);
Response.Flush();
}