Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Downloading ZIP file has ASPX extension in File Download POPUP

Status
Not open for further replies.

kenpogi

Programmer
Jun 30, 2004
11
US

I'm trying to download a word document into a ZIP file. Basically, the page appears as a page.aspx window. When I try and force the download (forcing the file name to be .zip), the download still specifies a .aspx to be saved. What can I do to force a .zip to be downloaded (especially in the Pop up of the file download where it asks you to Open/Save/Cancel)

thanks a lot in advance
 
hey ppl

i got it to work using the ff code:

Dim strFileNamePath As String

strFileNamePath = System.IO.Path.GetFullPath(fileName)
Dim myFile As System.IO.FileInfo = New System.IO.FileInfo(strFileNamePath)

HttpContext.Current.Response.Clear()

HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" & _
Replace(myFile.Name, ".resources", ""))

HttpContext.Current.Response.AddHeader("Content-Length", myFile.Length.ToString())

If type <> "" Then
HttpContext.Current.Response.ContentType = type
Else
HttpContext.Current.Response.ContentType = "application/octet-stream"
End If

HttpContext.Current.Response.WriteFile(myFile.FullName)
HttpContext.Current.Response.Flush()

however, when deployed in the web server (windows 2003), it seems that the downloaded file (zip file) doesn't contain anything. although when i tested it in my local machine (XP), the code works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top