Errors Streaming Excel File


G

Guest

I'm trying to stream an Excel file to IE from an ASP.NET page (VB.NET 1.1).
I've been searching the web for a couple of days and found many different but
similar methods, tried everything I've found and none of it works for me. I
consistently get the following two error messages, in this order:

"Could not open '<MY URL>'."

"Microsoft Office Excel cannot access the file '<MY URL>'. There are several
possible reasons: The file name or path does not exist. The file is being
used by another program. The workbook you are trying to save has the same
name as a currently open workbook."

The code I am currently using is as follows ...

Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("content-length", Convert.ToString(Bytes.Length))
Response.OutputStream.Write(Bytes, 0, Convert.ToInt32(Bytes.Length))
Response.Flush()

Bytes is a Byte array containing the file. Ultimately I want to be using a
Byte array generated by Report Services, but have also tried reading an Excel
file from the file system into a Byte array to rule out Report Services as
the source of my grief.

This code (with ContentType="application/pdf") works fine when streaming a
PDF, but I just can't get it to work with Excel.

Can anyone help please?

Many thanks in advance,
Rob

P.S. Please let me know if this would be better posted elsewhere.
 
Ad

Advertisements

G

Guest

I'm trying to stream an Excel file to IE from an ASP.NET page (VB.NET 1.1).
I've been searching the web for a couple of days and found many different but
similar methods, tried everything I've found and none of it works for me. I
consistently get the following two error messages, in this order:

"Could not open '<MY URL>'."

"Microsoft Office Excel cannot access the file '<MY URL>'. There are several
possible reasons: The file name or path does not exist. The file is being
used by another program. The workbook you are trying to save has the same
name as a currently open workbook."

The code I am currently using is as follows ...

Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("content-length", Convert.ToString(Bytes.Length))
Response.OutputStream.Write(Bytes, 0, Convert.ToInt32(Bytes.Length))
Response.Flush()

Bytes is a Byte array containing the file. Ultimately I want to be using a
Byte array generated by Report Services, but have also tried reading an Excel
file from the file system into a Byte array to rule out Report Services as
the source of my grief.

This code (with ContentType="application/pdf") works fine when streaming a
PDF, but I just can't get it to work with Excel.

Can anyone help please?

Many thanks in advance,
Rob

P.S. Please let me know if this would be better posted elsewhere.

Do you use SSL?
 
Ad

Advertisements

G

Guest

Anon User said:
Do you use SSL?

I hope to eventually, but I'm not using it for this page at the moment as
I'm struggling to get the PDFs working with that too!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top