"At the return the byte count is 129154 bytes. After the call br is 127376 bytes."
I interpret this as fnBuildImageFile() returns a stream of length 129154 and the BinaryReader actually contains a stream of length 127376. Sounds to me an issue with the defualt encoding of UTF8 on the BinaryReader? You may try the constructor BinaryReader(m_msImage, Encoding.ASCII) for creating the BinaryReader. When writing to a file works, what encoding is being used? Chad On Wed, 7 Jul 2004 13:40:58 -0400, Eddie Jackson <[EMAIL PROTECTED]> wrote: >Guys, > > Thanks for all your input it has helped me isolate but I am still having a little trouble. The problem may not be in the BinaryWrite. Here is a couple of snippits. First is the Function that builds the byte(). Then the call of the object. At the return the byte count is 129154 bytes. After the call br is 127376 bytes. I know that the fnBuildImageByteArray works because I have another call that writes it to a file and the file is fine. This is a remoted call. I don't think that should cause any problems. It uses tcp and binary formater. When the file is built it is on the remoted server. Thanks for any help. > > >Public Function fnBuildImageByteArray() As Byte() > m_msImage = fnBuildImageFile() > Dim br As BinaryReader = New BinaryReader(m_msImage) > If m_msImage.Length = 0 And m_strErrorCode.Trim.Length = 0 Then > m_strErrorCode = "Unknown Error" > Else > m_strErrorCode = "Success" > End If > > Return br.ReadBytes(m_msImage.Length) >End Function > > >Dim br As Byte() = ig.fnBuildImageByteArray >Response.Clear() >Response.AddHeader("Content-Length", br.Length) >Response.Buffer = False >Response.ContentType = "image/tif" >Response.AddHeader("Content-Type", "image/tif") >Response.AddHeader("Content-Disposition", "attachment;filename=image.tif") >Response.AddHeader("Content-Disposition", "inline;filename=image.tiff") >Response.BinaryWrite(br) >Response.Flush() >Response.End() > >-----Original Message----- >From: Chad M. Gross [mailto:[EMAIL PROTECTED] >Sent: Wednesday, July 07, 2004 10:44 AM >To: [EMAIL PROTECTED] >Subject: Re: [ADVANCED-DOTNET] ASP.NET BinaryWrite > > >If everyting is working for you correctly, you should get either the Open >or SaveAs option based on the attachment in the header. If you do a >SaveAs and then open the file in any program that can open a tiff does the >file display correctly? > >Another posibility that can cause problems is based on whether you are >using a postback to perform this Reponse.BinaryWrite. It's possible that >you have written some other headers (or HTML) to the repsonse stream that >is hosing up your tiff data. You can also try doing a Response.Clear() >before setting your Response.Buffer = false, and then perform your >Response.BinaryWrite(). > >Chad > >On Wed, 7 Jul 2004 11:40:10 -0400, Eddie Jackson <[EMAIL PROTECTED]> >wrote: > >>I caught that it was only in the email.... Still does not work. The Fax >Viewer pops up and the wait cursor is up for a few seconds but no >file...... I have checked the bytes and they are in the array..... >> >>Thanks >> >>Eddie >> >>-----Original Message----- >>From: Chad M. Gross [mailto:[EMAIL PROTECTED] >>Sent: Wednesday, July 07, 2004 10:19 AM >>To: [EMAIL PROTECTED] >>Subject: Re: [ADVANCED-DOTNET] ASP.NET BinaryWrite >> >> >>You need a semi-colon between attachment and filename in the Content- >>Disposition header, "attachment;filename=image.tiff". >> >>On Wed, 7 Jul 2004 11:14:23 -0400, Eddie Jackson <[EMAIL PROTECTED]> >>wrote: >> >>>I have tried this and I still do not get the window to open. Here is the >>code that I am using... Do you see anything that I am doing wrong????? >>> >>>Dim br As Byte() = ig.fnBuildImageByteArray >>>Response.Buffer = False >>>Response.ContentType = "image/tiff" >>>Response.AddHeader("Content-Type", "image/tiff") >>>Response.AddHeader("Content- >Disposition", "attachmentfilename=image.tiff") >>>Response.BinaryWrite(br) >>>Response.End() >>> >>>-----Original Message----- >>>From: Stephen Dunn [mailto:[EMAIL PROTECTED] >>>Sent: Wednesday, July 07, 2004 8:59 AM >>>To: [EMAIL PROTECTED] >>>Subject: Re: [ADVANCED-DOTNET] ASP.NET BinaryWrite >>> >>> >>>When you say 'opening new window', I assume you mean a separate window >>>with the associated application for .tiff files? If so, then your line: >>> >>>Response.AddHeader("Content-Disposition", "inline;filename=image.tiff") >>>Should be changed to: >>>Response.AddHeader("Content-Disposition", "attachment; >>>filename=image.tiff") >>> >>>-----Original Message----- >>>From: Unmoderated discussion of advanced .NET topics. >>>[mailto:[EMAIL PROTECTED] On Behalf Of Eddie Jackson >>>Sent: 07 July 2004 14:46 >>>To: [EMAIL PROTECTED] >>>Subject: [ADVANCED-DOTNET] ASP.NET BinaryWrite >>> >>>I am trying to use Response.BinaryWrite to open a new window with a tif >>>file. A multipage tif is built on the fly with a memoryfile and is in a >>>byte Array. I have tried various itterations of the code below. It has >>>opened the image/fax viewer but there is no content. I know the byte >>>array is populated properly. Please help.... >>> >>>Thanks >>> >>>'Response.Buffer = False >>>'Response.Charset = "UTF-8" >>>Response.ContentType = "image/tiff" >>>'Response.AddHeader("Content-Type", "image/tif") >>>'Response.AddHeader("Content-Disposition", "inline;filename=image.tiff") >>>Response.BinaryWrite(br) >>>Response.End() >>> >>>=================================== >>>This list is hosted by DevelopMentor(r) http://www.develop.com >>>Some .NET courses you may be interested in: >>> >>>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles >>>http://www.develop.com/courses/gaspdotnetls >>> >>>View archives and manage your subscription(s) at >>>http://discuss.develop.com >>> >>> >>>This email and any attachments are confidential. They may contain >>privileged information and are intended for the named addressee(s) only. >>They must not be distributed without Perfect Information's consent. If you >>are not the intended recipient, please notify us immediately and do not >>disclose, distribute, or retain this email or any part of it. Unless >>expressly stated, opinions in this email are those of the individual >>sender, and not of Perfect Information. We believe but do not warrant that >>this e-mail and any attachments are virus free. You must therefore take >>full responsibility for virus checking. Perfect Information reserves the >>right to monitor all email communications through their networks. >>> >>>=================================== >>>This list is hosted by DevelopMentorŪ http://www.develop.com >>>Some .NET courses you may be interested in: >>> >>>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles >>>http://www.develop.com/courses/gaspdotnetls >>> >>>View archives and manage your subscription(s) at >>http://discuss.develop.com >>> >>>=================================== >>>This list is hosted by DevelopMentorŪ http://www.develop.com >>>Some .NET courses you may be interested in: >>> >>>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles >>>http://www.develop.com/courses/gaspdotnetls >>> >>>View archives and manage your subscription(s) at >>http://discuss.develop.com >> >>=================================== >>This list is hosted by DevelopMentorŪ http://www.develop.com >>Some .NET courses you may be interested in: >> >>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles >>http://www.develop.com/courses/gaspdotnetls >> >>View archives and manage your subscription(s) at >http://discuss.develop.com >> >>=================================== >>This list is hosted by DevelopMentorŪ http://www.develop.com >>Some .NET courses you may be interested in: >> >>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles >>http://www.develop.com/courses/gaspdotnetls >> >>View archives and manage your subscription(s) at >http://discuss.develop.com > >=================================== >This list is hosted by DevelopMentorŪ http://www.develop.com >Some .NET courses you may be interested in: > >NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles >http://www.develop.com/courses/gaspdotnetls > >View archives and manage your subscription(s) at http://discuss.develop.com > >=================================== >This list is hosted by DevelopMentorŪ http://www.develop.com >Some .NET courses you may be interested in: > >NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles >http://www.develop.com/courses/gaspdotnetls > >View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com