By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,742 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,742 IT Pros & Developers. It's quick & easy.

Streaming XLS to the client - ignore previous thread

P: n/a
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

Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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...;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.)

Jul 19 '05 #2

P: n/a
CJM

"[MSFT]" <lu******@online.microsoft.com> wrote in message
news:hr**************@cpmsftngxa10.phx.gbl...
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...;EN-US;Q276488


I'll check this out..

Thanks
Jul 19 '05 #3

P: n/a
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.)

Jul 19 '05 #4

P: n/a
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

"[MSFT]" <lu******@online.microsoft.com> wrote in message
news:lL**************@cpmsftngxa10.phx.gbl...
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.)

Jul 19 '05 #5

P: n/a
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...;EN-US;Q317208

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

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

PRB: Internet Explorer Is Unable to Open Office Documents from an SSL Web
Site
http://support.microsoft.com/default...;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.)

Jul 19 '05 #6

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

Thanks

Chris

"[MSFT]" <lu******@online.microsoft.com> wrote in message
news:R5**************@cpmsftngxa10.phx.gbl...
Hi Chris,

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

Cannot open an Excel 2003 workbook by using Internet Explorer 6.0
http://support.microsoft.com/default...;EN-US;Q840386
Luke
Microsoft Online Support

Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.