system.platformnotsupportedexception while trying to download a PDF from HttpHandler

May 3, 2013 at 9:35 AM
Hello All,

I am trying to download a PDF file using the context.response object of the httphandler.
 PdfDocument doc = new PdfDocument();
            Cookie netCookie = HttpCookieToCookie(context);
            HtmlToPdf.Options.Cookies.Add(netCookie);
            HtmlToPdf.ConvertUrl(currentPageUrl, doc);
            ////Setup HttpResponse headers
            context.Response.Clear();
            context.Response.ClearHeaders();
            context.Response.ContentType = "application/pdf";
            context.Response.AddHeader("content-disposition", "attachment; filename=" + fileName);
            doc.Save(context.Response.OutputStream);
            context.Response.Flush();
            context.Response.End();
But i am not receiving any PDF file on the browser after the execution of the above code.
While using the quickwatch on context.response object i am getting the following error
'context.Response.Headers' threw an exception of type 'System.PlatformNotSupportedException' and System.SystemException "This operation requires IIS integrated pipeline mode."

Is there any solution for this using the Cassini server as i am not having iis on my development machine ?
May 14, 2014 at 12:13 AM
You got a solution to this ? I am facing exact same issue.