Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Gibberish Pdf file displayed if I transfer using bit stream

Reply
Thread Tools

Gibberish Pdf file displayed if I transfer using bit stream

 
 
c676228
Guest
Posts: n/a
 
      02-09-2007
Hi all,
The following code was suggested by one of the users in this newsgroup when
a pdf file was requested by a user from an asp page. I used the similar code
in my page and the very interesting thing is when the pdf is displayed on the
fly, the whole page is a gibberish code in stead of a normal pdf file. But it
displays fine if I just use a link to a file on the page. Can you tell me
what's the possible reason will cause this problem?
Thank you.


> if objFSO.FileExists(strFilePath) AND ok then
> Set objStream = Server.CreateObject("ADODB.Stream")
> objStream.Open
> objStream.Type = 1
> objStream.LoadFromFile strFilePath
> Response.Buffer = false
> Response.ContentType = "application/pdf"
> Response.AddHeader "Content-Type", "application/pdf"
> Response.AddHeader "Content-Disposition","inline;filename="&once
> Response.BinaryWrite objStream.Read
> Response.Flush
> objStream.Close
> Set objStream = Nothing
> else
> response.write "Sorry, nonexisting file"
> end if
> Set objFSO = Nothing
> Response.end
> end if


--
Betty
 
Reply With Quote
 
 
 
 
c676228
Guest
Posts: n/a
 
      02-09-2007
Oh, I forgot to tell you that I removed the code
Response.Buffer = false
since I set up this is true some where, it tells me that I cannot reset to
false.
So I removed that, not sure if this will impact on the result, I guess not?
--
Betty


"c676228" wrote:

> Hi all,
> The following code was suggested by one of the users in this newsgroup when
> a pdf file was requested by a user from an asp page. I used the similar code
> in my page and the very interesting thing is when the pdf is displayed on the
> fly, the whole page is a gibberish code in stead of a normal pdf file. But it
> displays fine if I just use a link to a file on the page. Can you tell me
> what's the possible reason will cause this problem?
> Thank you.
>
>
> > if objFSO.FileExists(strFilePath) AND ok then
> > Set objStream = Server.CreateObject("ADODB.Stream")
> > objStream.Open
> > objStream.Type = 1
> > objStream.LoadFromFile strFilePath
> > Response.Buffer = false
> > Response.ContentType = "application/pdf"
> > Response.AddHeader "Content-Type", "application/pdf"
> > Response.AddHeader "Content-Disposition","inline;filename="&once
> > Response.BinaryWrite objStream.Read
> > Response.Flush
> > objStream.Close
> > Set objStream = Nothing
> > else
> > response.write "Sorry, nonexisting file"
> > end if
> > Set objFSO = Nothing
> > Response.end
> > end if

>
> --
> Betty

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      02-09-2007

"c676228" <> wrote in message
news:8126178E-50C6-4FBE-9A7E-...
> Hi all,
> The following code was suggested by one of the users in this newsgroup

when
> a pdf file was requested by a user from an asp page. I used the similar

code
> in my page and the very interesting thing is when the pdf is displayed on

the
> fly, the whole page is a gibberish code in stead of a normal pdf file. But

it
> displays fine if I just use a link to a file on the page. Can you tell me
> what's the possible reason will cause this problem?
> Thank you.
>
>
> > if objFSO.FileExists(strFilePath) AND ok then
> > Set objStream = Server.CreateObject("ADODB.Stream")
> > objStream.Open
> > objStream.Type = 1
> > objStream.LoadFromFile strFilePath
> > Response.Buffer = false
> > Response.ContentType = "application/pdf"
> > Response.AddHeader "Content-Type", "application/pdf"
> > Response.AddHeader "Content-Disposition","inline;filename="&once
> > Response.BinaryWrite objStream.Read
> > Response.Flush
> > objStream.Close
> > Set objStream = Nothing
> > else
> > response.write "Sorry, nonexisting file"
> > end if
> > Set objFSO = Nothing
> > Response.end
> > end if

>


Do you have other include files in the ASP code?
Do you have other content that is being sent before this code?
The inability to use Response.Buffer = false would indicate that you do.

In the case above Response.Buffer = false in unnecessary since you write the
complete contents of the stream to the response in one call to BinaryWrite.

On IIS6 the default response buffer is 4MB so if your PDF is potentially
larger you will either need to increase this limit or chunk out the PDF
contents.

This is my stock function for doing this:-

Sub SendFileToResponse(FilePath, FileName)

Const clChunkSize = 1048576 ' 1MB

Dim oStream, i
Response.Buffer = False

Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", _
"Filename=" & FileName

Set oStream = Server.CreateObject("ADODB.Stream")
oStream.Type = 1 ' Binary
oStream.Open
oStream.LoadFromFile FilePath

For i = 1 To oStream.Size \ clChunkSize
Response.BinaryWrite oStream.Read(clChunkSize)
Next
If (oStream.Size Mod clChunkSize) <> 0 Then
Response.BinaryWrite oStream.Read(oStream.Size Mod clChunkSize)
End If
oStream.Close

End Sub

You would call this function as:-

SendFileToResponse strFilePath, once

since it chunks out the content there is no need to worry about buffer size.
However before you can use it you will need to look at what is happening
earlier in your page that is already placing unwanted content in the
response.

Anthony.


> --
> Betty



 
Reply With Quote
 
c676228
Guest
Posts: n/a
 
      02-09-2007
Hi Anthony,
we us IIS 5.0
Thanks for your suggestion. I do have include file, but it has nothing about
buffer set up, no html code, only database connection include file. And I
went to IIS virtual direcotry and saw default configuration for the
application is "enable buffer", so I unchecked this option and it no longer
complains the statement "Response.Buffer = false ".
My pdf file is not big at all, it's less than 90KB. Now after I changed the
code, it gives me very informational error message like this:
Response object error 'ASP 0156 : 80004005'

Header Error

/DeliverPdf.asp, line 48 'which is Response.ContentType =
"application/octet-stream"

The HTTP headers are already written to the client browser. Any HTTP header
modifications must be made before writing page content.
--'end of the eeror message
Then I thought it is because we have default HTTP headers in virtual
directoy, which is something generated by the system like this:
P3P: xxxxx
x-powered by: asp.net
Then I removed that default header and it still display the same error
message.
I don't get this.

My code is as follow:
----deleiverpdf.asp
<!--#INCLUDE VIRTUAL = "/utility/init_test.asp" -->
'init_test is database connection file
<html>
<%
cmdTemp.CommandText="a sql comand to fetch record from system based filename"
dim FileName, strFilePath
'Response.End
Set pdf_info = Server.CreateObject("ADODB.Recordset")
pdf_info.Open cmdTemp, , adOpenKeyset, adLockOptimistic
If pdf_info.EOF Then
response.redirect "/noPicFound404.gif"
Else
pdf_info.MoveFirst()
'Response.Write "File Name: " & pdf_info("pdfFileName")
OK=False
If Request("FileName")=Trim(pdf_info("pdfFileName")) Then
strFilePath = Server.MapPath(pdf_info("TempPdfFilePath"))& "\" &
Request("FileName")
'Response.Write " Path " & strFilePath
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If CInt(pdf_info("MinElapsed")) < CInt(pdf_info("ExpTime")) then
OK=true
End If
If objFSO.FileExists(strFilePath) and OK Then
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilePath
Response.Buffer = false
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Type", "application/pdf"
Response.AddHeader
"Content-Disposition","inline;filename="&Request("FileName" ) %>
<body>
<%Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Set objStream = Nothing
'Response.Write "I am inside pdf delivery."
Else
response.write "Sorry, the file doesn't exist."
End If
Set objFSO = Nothing
Response.end
End If 'End If FileName is the same as in the database system

End If 'End If pdf_info is EOF


'End Function
Response.Write FileName & "<br>"
Response.Write strFilePath & "<br>"
conn.Close
set conn=Nothing
cmdTemp.Close
set cmdTemp=Nothing
%>
</body>
</html>



--
Betty


"Anthony Jones" wrote:

>
> "c676228" <> wrote in message
> news:8126178E-50C6-4FBE-9A7E-...
> > Hi all,
> > The following code was suggested by one of the users in this newsgroup

> when
> > a pdf file was requested by a user from an asp page. I used the similar

> code
> > in my page and the very interesting thing is when the pdf is displayed on

> the
> > fly, the whole page is a gibberish code in stead of a normal pdf file. But

> it
> > displays fine if I just use a link to a file on the page. Can you tell me
> > what's the possible reason will cause this problem?
> > Thank you.
> >
> >
> > > if objFSO.FileExists(strFilePath) AND ok then
> > > Set objStream = Server.CreateObject("ADODB.Stream")
> > > objStream.Open
> > > objStream.Type = 1
> > > objStream.LoadFromFile strFilePath
> > > Response.Buffer = false
> > > Response.ContentType = "application/pdf"
> > > Response.AddHeader "Content-Type", "application/pdf"
> > > Response.AddHeader "Content-Disposition","inline;filename="&once
> > > Response.BinaryWrite objStream.Read
> > > Response.Flush
> > > objStream.Close
> > > Set objStream = Nothing
> > > else
> > > response.write "Sorry, nonexisting file"
> > > end if
> > > Set objFSO = Nothing
> > > Response.end
> > > end if

> >

>
> Do you have other include files in the ASP code?
> Do you have other content that is being sent before this code?
> The inability to use Response.Buffer = false would indicate that you do.
>
> In the case above Response.Buffer = false in unnecessary since you write the
> complete contents of the stream to the response in one call to BinaryWrite.
>
> On IIS6 the default response buffer is 4MB so if your PDF is potentially
> larger you will either need to increase this limit or chunk out the PDF
> contents.
>
> This is my stock function for doing this:-
>
> Sub SendFileToResponse(FilePath, FileName)
>
> Const clChunkSize = 1048576 ' 1MB
>
> Dim oStream, i
> Response.Buffer = False
>
> Response.ContentType = "application/octet-stream"
> Response.AddHeader "Content-Disposition", _
> "Filename=" & FileName
>
> Set oStream = Server.CreateObject("ADODB.Stream")
> oStream.Type = 1 ' Binary
> oStream.Open
> oStream.LoadFromFile FilePath
>
> For i = 1 To oStream.Size \ clChunkSize
> Response.BinaryWrite oStream.Read(clChunkSize)
> Next
> If (oStream.Size Mod clChunkSize) <> 0 Then
> Response.BinaryWrite oStream.Read(oStream.Size Mod clChunkSize)
> End If
> oStream.Close
>
> End Sub
>
> You would call this function as:-
>
> SendFileToResponse strFilePath, once
>
> since it chunks out the content there is no need to worry about buffer size.
> However before you can use it you will need to look at what is happening
> earlier in your page that is already placing unwanted content in the
> response.
>
> Anthony.
>
>
> > --
> > Betty

>
>
>

 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      02-09-2007

"c676228" <> wrote in message
news:FFDBA054-61DE-4693-9AA0-...
> Hi Anthony,
> we us IIS 5.0
> Thanks for your suggestion. I do have include file, but it has nothing

about
> buffer set up, no html code, only database connection include file. And I
> went to IIS virtual direcotry and saw default configuration for the
> application is "enable buffer", so I unchecked this option and it no

longer
> complains the statement "Response.Buffer = false ".


I strongly recommend you turn that back on again.

> My pdf file is not big at all, it's less than 90KB. Now after I changed

the
> code, it gives me very informational error message like this:
> Response object error 'ASP 0156 : 80004005'
>
> Header Error
>
> /DeliverPdf.asp, line 48 'which is Response.ContentType =
> "application/octet-stream"
>
> The HTTP headers are already written to the client browser. Any HTTP

header
> modifications must be made before writing page content.
> --'end of the eeror message
> Then I thought it is because we have default HTTP headers in virtual
> directoy, which is something generated by the system like this:
> P3P: xxxxx
> x-powered by: asp.net
> Then I removed that default header and it still display the same error
> message.
> I don't get this.
>
> My code is as follow:
> ----deleiverpdf.asp
> <!--#INCLUDE VIRTUAL = "/utility/init_test.asp" -->
> 'init_test is database connection file
> <html>


The above is part of the problem you've started to send html content but you
want to send a pdf. Your page should only contain ASP code in <% %>. There
should be no HTML mark up in it at all.

> <%
> cmdTemp.CommandText="a sql comand to fetch record from system based

filename"
> dim FileName, strFilePath
> 'Response.End
> Set pdf_info = Server.CreateObject("ADODB.Recordset")
> pdf_info.Open cmdTemp, , adOpenKeyset, adLockOptimistic
> If pdf_info.EOF Then
> response.redirect "/noPicFound404.gif"
> Else
> pdf_info.MoveFirst()
> 'Response.Write "File Name: " & pdf_info("pdfFileName")
> OK=False
> If Request("FileName")=Trim(pdf_info("pdfFileName")) Then
> strFilePath = Server.MapPath(pdf_info("TempPdfFilePath"))& "\" &
> Request("FileName")
> 'Response.Write " Path " & strFilePath
> Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
> If CInt(pdf_info("MinElapsed")) < CInt(pdf_info("ExpTime")) then
> OK=true
> End If
> If objFSO.FileExists(strFilePath) and OK Then
> Set objStream = Server.CreateObject("ADODB.Stream")
> objStream.Open
> objStream.Type = 1
> objStream.LoadFromFile strFilePath
> Response.Buffer = false
> Response.ContentType = "application/octet-stream"
> Response.AddHeader "Content-Type", "application/pdf"
> Response.AddHeader
> "Content-Disposition","inline;filename="&Request("FileName" )


Get rid of this bit of markup also

%>
> <body>
> <%



> Response.BinaryWrite objStream.Read
> Response.Flush
> objStream.Close
> Set objStream = Nothing
> 'Response.Write "I am inside pdf delivery."
> Else
> response.write "Sorry, the file doesn't exist."
> End If
> Set objFSO = Nothing
> Response.end
> End If 'End If FileName is the same as in the database system
>
> End If 'End If pdf_info is EOF
>
>
> 'End Function
> Response.Write FileName & "<br>"
> Response.Write strFilePath & "<br>"
> conn.Close
> set conn=Nothing
> cmdTemp.Close
> set cmdTemp=Nothing
> %>


And this bit as well:

> </body>
> </html>





> --
> Betty
>
>
> "Anthony Jones" wrote:
>
> >
> > "c676228" <> wrote in message
> > news:8126178E-50C6-4FBE-9A7E-...
> > > Hi all,
> > > The following code was suggested by one of the users in this newsgroup

> > when
> > > a pdf file was requested by a user from an asp page. I used the

similar
> > code
> > > in my page and the very interesting thing is when the pdf is displayed

on
> > the
> > > fly, the whole page is a gibberish code in stead of a normal pdf file.

But
> > it
> > > displays fine if I just use a link to a file on the page. Can you tell

me
> > > what's the possible reason will cause this problem?
> > > Thank you.
> > >
> > >
> > > > if objFSO.FileExists(strFilePath) AND ok then
> > > > Set objStream = Server.CreateObject("ADODB.Stream")
> > > > objStream.Open
> > > > objStream.Type = 1
> > > > objStream.LoadFromFile strFilePath
> > > > Response.Buffer = false
> > > > Response.ContentType = "application/pdf"
> > > > Response.AddHeader "Content-Type", "application/pdf"
> > > > Response.AddHeader "Content-Disposition","inline;filename="&once
> > > > Response.BinaryWrite objStream.Read
> > > > Response.Flush
> > > > objStream.Close
> > > > Set objStream = Nothing
> > > > else
> > > > response.write "Sorry, nonexisting file"
> > > > end if
> > > > Set objFSO = Nothing
> > > > Response.end
> > > > end if
> > >

> >
> > Do you have other include files in the ASP code?
> > Do you have other content that is being sent before this code?
> > The inability to use Response.Buffer = false would indicate that you do.
> >
> > In the case above Response.Buffer = false in unnecessary since you write

the
> > complete contents of the stream to the response in one call to

BinaryWrite.
> >
> > On IIS6 the default response buffer is 4MB so if your PDF is potentially
> > larger you will either need to increase this limit or chunk out the PDF
> > contents.
> >
> > This is my stock function for doing this:-
> >
> > Sub SendFileToResponse(FilePath, FileName)
> >
> > Const clChunkSize = 1048576 ' 1MB
> >
> > Dim oStream, i
> > Response.Buffer = False
> >
> > Response.ContentType = "application/octet-stream"
> > Response.AddHeader "Content-Disposition", _
> > "Filename=" & FileName
> >
> > Set oStream = Server.CreateObject("ADODB.Stream")
> > oStream.Type = 1 ' Binary
> > oStream.Open
> > oStream.LoadFromFile FilePath
> >
> > For i = 1 To oStream.Size \ clChunkSize
> > Response.BinaryWrite oStream.Read(clChunkSize)
> > Next
> > If (oStream.Size Mod clChunkSize) <> 0 Then
> > Response.BinaryWrite oStream.Read(oStream.Size Mod clChunkSize)
> > End If
> > oStream.Close
> >
> > End Sub
> >
> > You would call this function as:-
> >
> > SendFileToResponse strFilePath, once
> >
> > since it chunks out the content there is no need to worry about buffer

size.
> > However before you can use it you will need to look at what is happening
> > earlier in your page that is already placing unwanted content in the
> > response.
> >
> > Anthony.
> >
> >
> > > --
> > > Betty

> >
> >
> >



 
Reply With Quote
 
c676228
Guest
Posts: n/a
 
      02-09-2007
Hooray! Anthony,

That works after I removed the html tag. Mm, I had another good lession.
Thank you.
--
Betty


"Anthony Jones" wrote:

>
> "c676228" <> wrote in message
> news:FFDBA054-61DE-4693-9AA0-...
> > Hi Anthony,
> > we us IIS 5.0
> > Thanks for your suggestion. I do have include file, but it has nothing

> about
> > buffer set up, no html code, only database connection include file. And I
> > went to IIS virtual direcotry and saw default configuration for the
> > application is "enable buffer", so I unchecked this option and it no

> longer
> > complains the statement "Response.Buffer = false ".

>
> I strongly recommend you turn that back on again.
>
> > My pdf file is not big at all, it's less than 90KB. Now after I changed

> the
> > code, it gives me very informational error message like this:
> > Response object error 'ASP 0156 : 80004005'
> >
> > Header Error
> >
> > /DeliverPdf.asp, line 48 'which is Response.ContentType =
> > "application/octet-stream"
> >
> > The HTTP headers are already written to the client browser. Any HTTP

> header
> > modifications must be made before writing page content.
> > --'end of the eeror message
> > Then I thought it is because we have default HTTP headers in virtual
> > directoy, which is something generated by the system like this:
> > P3P: xxxxx
> > x-powered by: asp.net
> > Then I removed that default header and it still display the same error
> > message.
> > I don't get this.
> >
> > My code is as follow:
> > ----deleiverpdf.asp
> > <!--#INCLUDE VIRTUAL = "/utility/init_test.asp" -->
> > 'init_test is database connection file
> > <html>

>
> The above is part of the problem you've started to send html content but you
> want to send a pdf. Your page should only contain ASP code in <% %>. There
> should be no HTML mark up in it at all.
>
> > <%
> > cmdTemp.CommandText="a sql comand to fetch record from system based

> filename"
> > dim FileName, strFilePath
> > 'Response.End
> > Set pdf_info = Server.CreateObject("ADODB.Recordset")
> > pdf_info.Open cmdTemp, , adOpenKeyset, adLockOptimistic
> > If pdf_info.EOF Then
> > response.redirect "/noPicFound404.gif"
> > Else
> > pdf_info.MoveFirst()
> > 'Response.Write "File Name: " & pdf_info("pdfFileName")
> > OK=False
> > If Request("FileName")=Trim(pdf_info("pdfFileName")) Then
> > strFilePath = Server.MapPath(pdf_info("TempPdfFilePath"))& "\" &
> > Request("FileName")
> > 'Response.Write " Path " & strFilePath
> > Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
> > If CInt(pdf_info("MinElapsed")) < CInt(pdf_info("ExpTime")) then
> > OK=true
> > End If
> > If objFSO.FileExists(strFilePath) and OK Then
> > Set objStream = Server.CreateObject("ADODB.Stream")
> > objStream.Open
> > objStream.Type = 1
> > objStream.LoadFromFile strFilePath
> > Response.Buffer = false
> > Response.ContentType = "application/octet-stream"
> > Response.AddHeader "Content-Type", "application/pdf"
> > Response.AddHeader
> > "Content-Disposition","inline;filename="&Request("FileName" )

>
> Get rid of this bit of markup also
>
> %>
> > <body>
> > <%

>
>
> > Response.BinaryWrite objStream.Read
> > Response.Flush
> > objStream.Close
> > Set objStream = Nothing
> > 'Response.Write "I am inside pdf delivery."
> > Else
> > response.write "Sorry, the file doesn't exist."
> > End If
> > Set objFSO = Nothing
> > Response.end
> > End If 'End If FileName is the same as in the database system
> >
> > End If 'End If pdf_info is EOF
> >
> >
> > 'End Function
> > Response.Write FileName & "<br>"
> > Response.Write strFilePath & "<br>"
> > conn.Close
> > set conn=Nothing
> > cmdTemp.Close
> > set cmdTemp=Nothing
> > %>

>
> And this bit as well:
>
> > </body>
> > </html>

>
>
>
>
> > --
> > Betty
> >
> >
> > "Anthony Jones" wrote:
> >
> > >
> > > "c676228" <> wrote in message
> > > news:8126178E-50C6-4FBE-9A7E-...
> > > > Hi all,
> > > > The following code was suggested by one of the users in this newsgroup
> > > when
> > > > a pdf file was requested by a user from an asp page. I used the

> similar
> > > code
> > > > in my page and the very interesting thing is when the pdf is displayed

> on
> > > the
> > > > fly, the whole page is a gibberish code in stead of a normal pdf file.

> But
> > > it
> > > > displays fine if I just use a link to a file on the page. Can you tell

> me
> > > > what's the possible reason will cause this problem?
> > > > Thank you.
> > > >
> > > >
> > > > > if objFSO.FileExists(strFilePath) AND ok then
> > > > > Set objStream = Server.CreateObject("ADODB.Stream")
> > > > > objStream.Open
> > > > > objStream.Type = 1
> > > > > objStream.LoadFromFile strFilePath
> > > > > Response.Buffer = false
> > > > > Response.ContentType = "application/pdf"
> > > > > Response.AddHeader "Content-Type", "application/pdf"
> > > > > Response.AddHeader "Content-Disposition","inline;filename="&once
> > > > > Response.BinaryWrite objStream.Read
> > > > > Response.Flush
> > > > > objStream.Close
> > > > > Set objStream = Nothing
> > > > > else
> > > > > response.write "Sorry, nonexisting file"
> > > > > end if
> > > > > Set objFSO = Nothing
> > > > > Response.end
> > > > > end if
> > > >
> > >
> > > Do you have other include files in the ASP code?
> > > Do you have other content that is being sent before this code?
> > > The inability to use Response.Buffer = false would indicate that you do.
> > >
> > > In the case above Response.Buffer = false in unnecessary since you write

> the
> > > complete contents of the stream to the response in one call to

> BinaryWrite.
> > >
> > > On IIS6 the default response buffer is 4MB so if your PDF is potentially
> > > larger you will either need to increase this limit or chunk out the PDF
> > > contents.
> > >
> > > This is my stock function for doing this:-
> > >
> > > Sub SendFileToResponse(FilePath, FileName)
> > >
> > > Const clChunkSize = 1048576 ' 1MB
> > >
> > > Dim oStream, i
> > > Response.Buffer = False
> > >
> > > Response.ContentType = "application/octet-stream"
> > > Response.AddHeader "Content-Disposition", _
> > > "Filename=" & FileName
> > >
> > > Set oStream = Server.CreateObject("ADODB.Stream")
> > > oStream.Type = 1 ' Binary
> > > oStream.Open
> > > oStream.LoadFromFile FilePath
> > >
> > > For i = 1 To oStream.Size \ clChunkSize
> > > Response.BinaryWrite oStream.Read(clChunkSize)
> > > Next
> > > If (oStream.Size Mod clChunkSize) <> 0 Then
> > > Response.BinaryWrite oStream.Read(oStream.Size Mod clChunkSize)
> > > End If
> > > oStream.Close
> > >
> > > End Sub
> > >
> > > You would call this function as:-
> > >
> > > SendFileToResponse strFilePath, once
> > >
> > > since it chunks out the content there is no need to worry about buffer

> size.
> > > However before you can use it you will need to look at what is happening
> > > earlier in your page that is already placing unwanted content in the
> > > response.
> > >
> > > Anthony.
> > >
> > >
> > > > --
> > > > Betty
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the point of having 16 bit colour if a computer monitor can only display 8 bit colour? How do you edit 16 bit colour when you can only see 8 bit? Scotius Digital Photography 6 07-13-2010 03:33 AM
ASP.net/VB.net generating gibberish in file write. Merennulli ASP .Net 1 02-22-2006 11:01 PM
file recovered, but data is gibberish kilroybass@usa.com Computer Support 5 11-17-2005 07:56 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit, Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new ! vvcd Computer Support 0 09-17-2004 08:15 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit,Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new! Ionizer Computer Support 1 01-01-2004 07:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57