Incorrect File Name in the File Open or File Save Dialog Boxes

G

Guest

I am tring to force Internet Explorer to save known file types. Here is the
code I am using.

Dim filepath As String = "C:\myFolder\myImage.jpg"
If Not filepath Is Nothing Then
If File.Exists(filepath) Then
Dim filename As String = Path.GetFileName(filepath)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/octet-stream"

Response.AddHeader("Content-Disposition", "attachment;
filename=""" & filename & """")
Response.Flush()
Response.WriteFile(filepath)

Response.End()
End If

What happens is I am prompted to save a file with the name of aspx page that
the above code is from. I found this article but it doesn't seem to apply to
me becuase I am running Internet Explorer version Version 6.0.2900.2180
Build 62900.2180
http://support.microsoft.com/kb/q303750
When I run the above code in a non IE brower I get the correct results (I am
prompted to save the file name myImage.jpb)


actxprxy.dll 6.0.2900.2180 100 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
advpack.dll 6.0.2900.2180 98 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
asctrls.ocx 6.0.2900.2180 112 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
browselc.dll 6.0.2900.2180 62 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
browseui.dll 6.0.2900.2518 993 KB 9/29/2004 1:47:03
PM C:\WINDOWS\system32 Microsoft Corporation
cdfview.dll 6.0.2900.2180 147 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
comctl32.dll 5.82.2900.2180 597 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
dxtrans.dll 6.3.2900.2180 197 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
dxtmsft.dll 6.3.2900.2180 350 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
iecont.dll <File Missing> Not Available Not Available Not Available Not
Available
iecontlc.dll <File Missing> Not Available Not Available Not Available Not
Available
iedkcs32.dll 16.0.2900.2180 316 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
iepeers.dll 6.0.2900.2180 244 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
iesetup.dll 6.0.2900.2180 62 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
ieuinit.inf Not Available 22 KB 8/10/2004 7:00:00 AM C:\WINDOWS\system32 Not
Available
iexplore.exe 6.0.2900.2180 91 KB 8/10/2004 7:00:00 AM C:\Program
Files\Internet Explorer Microsoft Corporation
imgutil.dll 6.0.2900.2180 35 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
inetcpl.cpl 6.0.2900.2180 350 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
inetcplc.dll 6.0.2600.0 108 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
inseng.dll 6.0.2900.2180 94 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
mlang.dll 6.0.2900.2180 573 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
msencode.dll 2000.7.25.0 92 KB 8/10/2004 7:00:00 AM C:\WINDOWS\system32 Not
Available
mshta.exe 6.0.2900.2180 29 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
mshtml.dll 6.0.2900.2523 2,935 KB 9/29/2004 1:47:04
PM C:\WINDOWS\system32 Microsoft Corporation
mshtml.tlb 6.0.2900.2180 1,320 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
mshtmled.dll 6.0.2900.2180 438 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
mshtmler.dll 6.0.2900.2180 56 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
msident.dll 6.0.2900.2180 51 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
msidntld.dll 6.0.2600.0 15 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
msieftp.dll 6.0.2900.2180 243 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
msrating.dll 6.0.2900.2180 143 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
mstime.dll 6.0.2900.2180 518 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
occache.dll 6.0.2900.2180 94 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
proctexe.ocx 6.3.2900.2180 80 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Intel Corporation
sendmail.dll 6.0.2900.2180 54 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
shdoclc.dll 6.0.2900.2180 537 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
shdocvw.dll 6.0.2900.2518 1,449 KB 9/29/2004 1:47:04
PM C:\WINDOWS\system32 Microsoft Corporation
shfolder.dll 6.0.2900.2180 25 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
shlwapi.dll 6.0.2900.2180 463 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
tdc.ocx 1.3.0.3130 60 KB 8/10/2004 7:00:00 AM C:\WINDOWS\system32 Microsoft
Corporation
url.dll 6.0.2900.2180 37 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
urlmon.dll 6.0.2900.2518 590 KB 9/29/2004 1:47:04
PM C:\WINDOWS\system32 Microsoft Corporation
webcheck.dll 6.0.2900.2180 270 KB 8/10/2004 7:00:00
AM C:\WINDOWS\system32 Microsoft Corporation
wininet.dll 6.0.2900.2518 642 KB 9/29/2004 1:47:04
PM C:\WINDOWS\system32 Microsoft Corporation
 

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