Skip to Content
author's profile photo Former Member
Former Member

EP 6.0 and Streaming Files to the browser

Hi there,

I'm done plenty of file streaming using BSP and Java now I need to do it in .NET. What I'm doing is I create an Excel file on the server and then try to stream it directly to the browser. My code is as follows and WORKS in a "standard" ASP.NET application BUT NOT in the SAP Portal application:

Private Sub StreamExcelFile(ByVal FilePath As String)

Dim strFileSize As String

Dim fso As Object = Server.CreateObject("scripting.filesystemobject")

Dim f As Object = fso.getfile(FilePath)

strFileSize = f.size

Const adTypeBinary = 1


Dim binaryData() As Byte

Dim FileStream As FileStream

FileStream = New System.IO.FileStream(FilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read)

ReDim binaryData(FileStream.Length)

FileStream.Read(binaryData, 0, FileStream.Length)

Response.AddHeader("Content-Disposition", "attachment; filename=mytestfile.xls")

Response.AddHeader("Content-Length", strFileSize)

Response.Charset = "UTF-8"

Response.ContentType = "application/"




End Sub

It brings up the "file open save dialog" but thats it.....the saved file has ZERO bytes. The funny thing is that it does work in a normal ASP.NET app? Also, some of my BSP applications that stream SmartForms from SAP to the browser still work? Does the EP 6.0 environment "manipulate" the binary in some way? Has it perhaps got something to do with COMPRESSION??

Any help would be greatly appreciated.....



Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 11:57 AM

    Just remove the


    from your code to make it work.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.