Link to home
Start Free TrialLog in
Avatar of scm0sml
scm0sml

asked on

httpresponse with jquery and c#

I have the following:
var response = System.Web.HttpContext.Current.Response;
            response.Clear();
            response.AddHeader("Content-Type", "binary/octet-stream");
            response.AddHeader("Content-Disposition", "attachment; filename=PMSQuestionnaireResults.pdf; size=" + pdfBytes.Length.ToString());          
            response.Flush();
            response.BinaryWrite(pdfBytes);
            response.Flush();
            response.End();

This is exporting a pdf that I have created and works fine.

I wanted to call the function that does this though with jquery.

This is now broken.

When I check the response in firebug I see:
%PDF-1.4
%¿¿¿¿
%Created by Wnv/EP PDF Tools v8.0
1 0 obj
<<
/Pages 2 0 R
/PageLayout /OneColumn
/PageMode /UseNone
/ViewerPreferences 3 0 R
/Type /Catalog
>>

endobj
2 0 obj
<<
/Count 2
/Kids [4 0 R 5 0 R]
/Type /Pages
>>

endobj
4 0 obj
<<
/Resources <<
/ProcSet [/PDF /Text /ImageC]
/XObject <<
/NAME_njifnhheinnmklihpcigknpdilkojllb 6 0 R
/NAME_himklphdmcenkdchpjfgnldlngmlkijm 7 0 R

Open in new window


Seems to be the content of the pdf?

Is there a way around this?

I could use a swift reply on this!

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Kiran Sonawane
Kiran Sonawane
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial