Response.BinaryWrite and IE7

G

Guest

I am trying to display a tiff image in the browsers. I have AlternaTIFF
activex control installed.
I am using the following code
FileStream fs = File.Open(@"c:\temp\test.tif",FileMode.Open);
long len = fs.Length;
byte[] myFile = new byte[len];
fs.Read(myFile, 0, (int)len);
fs.Close();
Response.ContentType = "application/x-alternatiff";
Response.BinaryWrite(myFile);
Response.Flush();
Response.Close();
that works just fine on IE6. However, on IE7 I am getting "A runtime error
occured. LIne: 1, Error: Invalid character" and in debugger it stopes with
"Microsoft JScript runtime error: Object expected".
If I look under Script Explorer I can see res://mshtml.dll/objectembed.js
which I am assuming in generating the JScript error.

Are there any settings or permissions with IE7 that would generate my error?
Are there any work arounds?

Thank you.
 
J

Jon Skeet [C# MVP]

Simona said:
I am trying to display a tiff image in the browsers. I have AlternaTIFF
activex control installed.
I am using the following code
FileStream fs = File.Open(@"c:\temp\test.tif",FileMode.Open);
long len = fs.Length;
byte[] myFile = new byte[len];
fs.Read(myFile, 0, (int)len);
fs.Close();
Response.ContentType = "application/x-alternatiff";
Response.BinaryWrite(myFile);
Response.Flush();
Response.Close();
that works just fine on IE6. However, on IE7 I am getting "A runtime error
occured. LIne: 1, Error: Invalid character" and in debugger it stopes with
"Microsoft JScript runtime error: Object expected".
If I look under Script Explorer I can see res://mshtml.dll/objectembed.js
which I am assuming in generating the JScript error.

Are there any settings or permissions with IE7 that would generate my error?
Are there any work arounds?

A quick Google search found this:

http://www.alternatiff.com/faq.html

Just search for "invalid character" on the page.
 
G

Guest

Thank you for the link. Unchecking the "Allow active content to run in files
on My Computer " gets rid of the java script error. My main problem at this
point is displaying the image.
We are getting the tiff files from a third party using a web service. We
don't want to store the images since we can get them on demand. We cannot ask
the user of our web application to change their registry and there is no zone
to add to the trusted sites since the image is in memory.

Is there any other way I can display the tiff file in the browser?

Jon Skeet said:
Simona said:
I am trying to display a tiff image in the browsers. I have AlternaTIFF
activex control installed.
I am using the following code
FileStream fs = File.Open(@"c:\temp\test.tif",FileMode.Open);
long len = fs.Length;
byte[] myFile = new byte[len];
fs.Read(myFile, 0, (int)len);
fs.Close();
Response.ContentType = "application/x-alternatiff";
Response.BinaryWrite(myFile);
Response.Flush();
Response.Close();
that works just fine on IE6. However, on IE7 I am getting "A runtime error
occured. LIne: 1, Error: Invalid character" and in debugger it stopes with
"Microsoft JScript runtime error: Object expected".
If I look under Script Explorer I can see res://mshtml.dll/objectembed.js
which I am assuming in generating the JScript error.

Are there any settings or permissions with IE7 that would generate my error?
Are there any work arounds?

A quick Google search found this:

http://www.alternatiff.com/faq.html

Just search for "invalid character" on the page.
 
J

Jon Skeet [C# MVP]

Simona said:
Thank you for the link. Unchecking the "Allow active content to run in files
on My Computer " gets rid of the java script error. My main problem at this
point is displaying the image.
We are getting the tiff files from a third party using a web service. We
don't want to store the images since we can get them on demand. We cannot ask
the user of our web application to change their registry and there is no zone
to add to the trusted sites since the image is in memory.

Is there any other way I can display the tiff file in the browser?

It looked from the FAQ as if it only affected one particular type of
tiff - although I didn't look in detail.

Do you *have* to show it as a tiff? Could you convert the tiff on the
fly into another image format?
 
G

Guest

I read the whole FAQ. I changed the registry but nothing seems to work for me
on IE7 even on I have the file on the disk and not just in memory.
I wasn't thinking about conversion but it sounds like my only chance at this
point. I am concerned a little bit about performance but I will definitely
look into conversion.

Thank you for your help
 

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

Top