Hi Brad,
From your description, you're using an ASP.NET web page to stream out some
binary files. And you found that the streaming page work will for IE and
firefox, but failed with some error when be visited by Safari browser,
correct?
From the code snippet you provided, the streaming code look correct. Also,
I've performed some tests on the public page you provided. I've tried all
the following browsers on windows system:
** IE7
**FireFox 2.0
**Safari 3.1.1
All the test works correctly(display the PDF file in browser). therefore,
I think the problem should be something specific to the client-side machine
or the network enviornmente. Have you tried accessing from multiple client
machine to see the behavior?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Reply-To: "Brad" <la**@newsgroup.nospam>
From: "Brad" <la**@newsgroup.nospam>
Subject: Help with streaming binary content to Safari
Date: Mon, 2 Jun 2008 17:47:37 -0700
>
I have an aspx page that is sending pdf files to client browsers: it uses
a filestream to read the pdf file and
>response.binarywrite to send content to the browser. This has worked
great for years in IE, Firefox and Opera on
>windows, and it works on a Mac with Firefox and Opera. But this fails in
Safari with the generic message "A network
>error occurred while accessing this document".
Here is a link to try out
http://www.lanecounty.org/TaxMap/Vie...ype=TM&id=2380
>
Here is a code snippet for the page.
switch (fi.Extension.ToLower())
{
case ".tif":
case ".tiff":
contentType = "image/tiff";
break;
case ".pdf":
contentType = "application/pdf";
break;
}
//########################################
FileStream fs = new FileStream(imageFile, FileMode.Open);
try
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.ContentType = contentType;
int FileLength = System.Convert.ToInt32(fs.Length);
byte[] buffer = new byte[FileLength + 1];
fs.Read(buffer, 0, FileLength);
HttpContext.Current.Response.BinaryWrite(buffer);
}
catch (Exception ex)
{
}
finally
{
fs.Close();
}
//########################################
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();