You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Response.BinaryWrite not working with Safari in MAC

I'm using ASP.NET to stream a PDF document to Safari (version 5.0.3), the streaming is working properly in Safari in Windows/iPad but it doesn't in MAC. Using the Safari Developer Tool, the following error is logged in Console error windows, "Failed to load resource: Plug-in handled load" So, I tried disabling the PDF installed plugin and it works. So I'm asking how to figure out what error is there and related to PDF plugin? or Does Safari in MAC requires specific stuff to make this work?


I'm using the following code for the file streaming

Response.ClearContent();

Response.ClearHeaders();

Response.AddHeader("Content-Length", fileBytes.Length.ToString());

Response.ContentType = "application/pdf";

Response.BinaryWrite(fileBytes);

Response.Flush();

System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest();

Mac OS X (10.6.5)

Posted on Jan 3, 2012 8:28 AM

Reply
1 reply

Jan 3, 2012 11:30 AM in response to Ahmed.Atia

I suggest running "curl" against some PDF resources that work properly and compare the results with a curl from your resource. It is the headers you want to look for. Normally there are 4-5 additional headers for this sort of thing.


Here is an example from one of Apple's more useful PDFs:

Pandora:~ jdaniel$ curl -I http://images.apple.com/business/docs/Autofs.pdf

HTTP/1.1 200 OK

ETag: "dc7f1-46ec52f2e0380"

X-Cached-Time: Mon, 02 Jan 2012 07:29:45 GMT

Server: Apache/2.2.3 (Oracle)

X-N: S

X-Cache-TTL: 362

Last-Modified: Wed, 15 Jul 2009 21:24:46 GMT

nnCoection: close

Accept-Ranges: bytes

Content-Length: 903153

Content-Type: application/pdf

Cache-Control: max-age=597

Expires: Tue, 03 Jan 2012 19:38:36 GMT

Date: Tue, 03 Jan 2012 19:28:39 GMT

Connection: keep-alive

Set-Cookie: ccl=nwBOXp0FgNB+yWfRV4Z2w9GSDt6Q522C; path=/; domain=.apple.com

Set-Cookie: geo=CA; path=/; domain=.apple.com


ASP.NET should have some handy routines for filling in appropriate values

Response.BinaryWrite not working with Safari in MAC

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.