views:

1102

answers:

4

I have a asp.net 1.1 application that uses the following code to write out a file in the response:

        Dim objStream As Object
        objStream = Server.CreateObject("ADODB.Stream")
        objStream.open()
        objStream.type = 1
        objStream.loadfromfile(localfile)
        Response.BinaryWrite(objStream.read)

This code is called by a pop up window that displays this file or gives a open/save dialog in Internet explorer. The problem is, that it seems to work fine in IE6 but in IE7 the pop up opens and then closes without displaying the file. Any one know whats wrong?

A: 

Have you tried setting the content type before the Response.BinaryWrite call?:

Response.ContentType = "image/tiff"

(or whatever your file type is).

Does the file that's a problem in IE7 have a 4 character file extension? If so, try a file with a 3 character extension...

Mitch Wheat
I'm setting the content type just like you have showed here.
Daud
You might want to show all relevant code in future...:)
Mitch Wheat
A: 

The pop up is coming out empty for some reason. Could the reason be that Adodb.Stream ActiveX is not installed or registered on the machine?

Daud
A: 

So the images that are being served by Asp.Net are tiff files. And it says here that IE7 doesn't display files with 4 letter extensions for some reason. I think I'll try to change it to 3 letters and see what happens.

Daud
@Xardas: you mean like I suggested above, 2 days before you posted this! ;)
Mitch Wheat
A: 

I have a code like this for download files from server:

strFilename = Server.MapPath("/App_Upload/" & strFilename)   

With Response
   .AddHeader("Content-Type", "binary/octet-stream")
   .AddHeader("Content-Disposition", "attachment; filename=" & strFilename & ";")
    .WriteFile(strFilename)
    .End()
End With

Try if work in your case.

pho3nix