在 IE7 中使用 Server.CreateObject(“ADODB.Stream”)

发布于 2024-07-09 06:35:09 字数 374 浏览 3 评论 0原文

我有一个 ASP.NET 1.1 应用程序,它使用以下代码在响应中写出一个文件:

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

此代码由显示此文件或在 Internet Explorer 中提供打开/保存对话框的弹出窗口调用。 问题是,它在 IE6 中似乎工作正常,但在 IE7 中,弹出窗口打开然后关闭,而不显示文件。 有谁知道出了什么问题吗?

I have an 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半山落雨半山空 2024-07-16 06:35:10

我有一个这样的代码,用于从服务器下载文件:

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

如果适合您的情况,请尝试。

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.

凑诗 2024-07-16 06:35:10

因此,Asp.Net 提供的图像是 tiff 文件。 这里说 IE7 不显示 4 个字母的文件由于某种原因进行扩展。 我想我会尝试将其更改为 3 个字母,看看会发生什么。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文