Streaming XLS to the client - ignore previous thread

C

CJM

[Sorry - having a bad day! Ignore the previous thread]

I have a page which allows the user to open one of several spreadsheets by
streaming the XLS to the client.

On my development site, everything appears to work fine. On the live site,
it works fine for the vast majority of users, but not for my colleague & I.

When this page is called with the correct inputs, the standard
Open/Save/Cancel/More Info dialog should appear. In the dialog, it gives the
following details:

Filename: Gothenburg Sweden.xls
File type: Microsoft Excel Spreadsheet
From: Servername

Clicking on open, means that the file will be opened in the local copy of
Excel; this works for most people, except one colleague and myself. In our
case, after clicking on Open, we get the following error msg:

"Internet Explorer cannot open travel.asp?journey=1 from <servername>
Internet Explorer was not able to open this internet site. The requested
site is either unavailable or cannot be found. Please try again later."

Anybody got any ideas about this?

TIA

Chris

Code Snippet:

sFileDir = Application("XLSDir")

If Len(sJourney) then
Select Case sJourney
Case 1
sFileName = "Gothenburg Sweden.xls"
sFilePath = sFileDir & sFilename
Response.AddHeader "content-disposition","attachment; filename=" &
"Gothenburg Sweden.xls"
Case 2
sFileName = "Nyköping Sweden.xls"
sFilePath = sFileDir & sFilename
Response.AddHeader "content-disposition","attachment; filename=" &
"Nyköping Sweden.xls"
Case Else
Response.Redirect "travel.asp"
End Select

' Create your header information
Response.ContentType = "application/asp-unknown"

' Create and configure your object
Set oFStream = Server.CreateObject("ADODB.Stream")
oFStream.Open()
oFStream.Type = 1
oFStream.LoadFromFile(sFilePath)

' Stream it to the client
Response.BinaryWrite oFStream.Read()

' Cleanup
oFStream.Close
Set oFStream = Nothing

' force the end
Response.End
End If
 
M

[MSFT]

Hi Chris,

From your description, the problem only occur on two clients. If other user
browser to same web page, they will get correct result. Is this right?

Regarding the problem, can you open other ASP pages in the same
application. For example, some page return normal HTML code instead XLS?

I also notice you used "application/asp-unknown", you may change it to
"application/x-msexcel" to see if this will help. Here is a complete sample
to send XSL from ASP:

HOWTO: Use the ADODB.Stream Object to Send Binary Files to the Browser
through ASP
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q276488

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
C

CJM

Hi Chris,

From your description, the problem only occur on two clients. If other user
browser to same web page, they will get correct result. Is this right?

As far as I know, only the two clients have this problem. In both cases, if
they try and access the development version of the application (which is on
my machine) they both work, but for the live version (on a Win2k3 server)
they dont.
Regarding the problem, can you open other ASP pages in the same
application. For example, some page return normal HTML code instead XLS?

The application has several other ASP pages which all work normally.
I also notice you used "application/asp-unknown", you may change it to
"application/x-msexcel" to see if this will help. Here is a complete sample
to send XSL from ASP:

I've changed this but it doesnt appear to have made a difference.
HOWTO: Use the ADODB.Stream Object to Send Binary Files to the Browser
through ASP
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q276488

I'll check this out..

Thanks
 
M

[MSFT]

Hi Chris,

You may try to clear the two clients computer's internet temporary files to
see if this will help. Additionally, It is better to use local
administrator to test so that we can ensure IE have enough permission to
load the XSL file.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
C

CJM

Luke,

I've tried clearing the temporary files but this has made no difference.
This is a sustained problem, so I didnt think this would be the issue, but
at least it is crossed off the list.

As for permissions, both users are Domain Administrators so we have
sufficient rights.

Chris
 
M

[MSFT]

Hi Chris,

You may take a look at following articles to see if they can address the
problem:

Internet Explorer Cannot Download Office Documents from an IIS Server When
Content Expiration Is Set to Expire Immediately
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q317208

An Error Message Occurs If You Click "Save Target As" for a Link
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q319032

Cannot open an Excel 2003 workbook by using Internet Explorer 6.0
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q840386

PRB: Internet Explorer Is Unable to Open Office Documents from an SSL Web
Site
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q316431


Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
C

CJM

I've contacted MS Support and they have sent me the patch mentioned in
Q840386, and it has worked a treat.

Thanks

Chris
 

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,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top