I'm using winnovative PDF converter and its working properly on my test project. but when i add same code to my original project,

shows that it throws following exceptions. exception]![enter image description here

i checked value of

 HttpResponse httpResponse = HttpContext.Current.Response;

and it shows values as above content.

how can I solve this. I tried this even after hosting in IIS server as well.

Edit:

byte[] pdfBytes = pdfConverter.GetPdfBytesFromUrl(htmlWithSvgUrl);

HttpResponse httpResponse = HttpContext.Current.Response;

// add the Content-Type and Content-Disposition HTTP headers
httpResponse.AddHeader("Content-Type", "application/pdf");
httpResponse.AddHeader("Content-Disposition", String.Format("attachment; filename=SvgToPdf.pdf; size={0}", pdfBytes.Length.ToString()));

// write the PDF document bytes as attachment to HTTP response 
httpResponse.BinaryWrite(pdfBytes);

// Note: it is important to end the response, otherwise the ASP.NET
// web page will render its content to PDF document stream
//httpResponse.End();
HttpContext.Current.ApplicationInstance.CompleteRequest();
1

There are 1 best solutions below

6
On

If your IIS version is 7.5 or higher, then the exception message which we should focus may be "this operation requires iis integrated pipeline mode"

I found this answer from this link http://forums.asp.net/t/1253457.aspx

As the error message indicated, it requires IIS integrated pipeline mode. Please select the application pool in IIS Manager, Click "Basic Settings..." and make sure "Integrated" mode is selected for "Managed pipeline mode" in the dialog.

Could you please check that?