BinaryWriting Excel Blobs

M

mb345345

Hi group, I have a nice little CMS application which has been running
for quite some time storing content in blobs in sql (the 'image'
datatype) and spitting them out to a frame in the browser via a page
called showContent.aspx:

Response.ContentType = strContentType
Response.BinaryWrite(objFileObject)

However, Excel seems to display some rather odd behaviour:

1/ When someone already has an Excel page open in the frame, they get:
"A document with the name showContent.aspx is already open..."
Does this mean that if the content type is excel, I need to redirect to
showContent2.aspx, showContent3.aspx, etc. *randomly*, so that it's
always a different name?? I'm prepared to do this, if it will solve the
problem, but it just seems like a real hack. I'm also toying with the
idea of storing excel docs physically, rather than as blobs in the db,
but that again would be a real pain.

2/ After the second or third excel sheet, excel seems to let them
through anyway and we get a string of "File error: data may have been
lost" errors (presumably to do with how the 'file' is being opened). If
you then click on any of the tabs of the excel sheet once it has limped
through this, the tab on the excel sheet disappears...!

Just wondering if I am doing anything obviously wrong re binarywriting
excel, and if so what I should be doing, although all other formats
seem to work fine (incl. pdf, flash, images, word, everything really!)

Any feedback is much appreciated, and if you would like any further
info (versions, etc.) then let me know but it's all up to date and
patched (and happening on multiple client machines).

Many thanks,
Mark
 
M

mb345345

FYI, I decided to implement an ugly hack:

If CInt(Session("ExcelHack")) = 1 Then
Session("ExcelHack") = 2
Else
Session("ExcelHack") = 1
Response.Redirect("showContent2.aspx")
End If

If anyone knows of a tidier way of fixing this, then do let me know.

Many thanks,
Mark
 

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

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,835
Latest member
lila30

Latest Threads

Top