Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
CajunRider
Starting Member
5 Posts |
Posted - 2004-07-19 : 12:05:47
|
I use the following code in an asp.net page to force download file from my site to the user:Response.Buffer = TrueResponse.Clear()Response.ContentType = "application/octet-stream"Response.AddHeader("Content-Disposition", "attachment; filename=""" & dsDocFile.Tables("tbl_DocFile").Rows.Find(FileID).Item("FileName") & """")Response.Flush()Response.WriteFile(sFileName)This works with most every file type I've run across (jpg, gif, doc, ppt, xls, etc..). Normally when the user tries to access a file, a download window pops up asking the user whether he/she wants to open or save the file. However, when the file is a zip file, the user just receives a blank screen instead of the usual download window. Has any one run into this problem? If yes, how did you resolve it?Thanks for your help. |
|
Dragonist
Starting Member
9 Posts |
Posted - 2004-07-20 : 03:29:03
|
I have a problem quite similiar to CajunRider too. What I tried to link is an .iwi file. Yes normally when the user click on the hyperlink, a download window will pops up asking whether he/she wants to open or save the file. What I am trying to figure out is to force straight away open the file without showing the Window pops up. Part of my code is shown below:cn9.Open()sc9.Connection = cn9sc9.CommandText = "Select fldMSDSFileName from tblMSDS where fldMSDSName ='" & dr.GetString(0) & "' "Dim dr9 As OleDb.OleDbDataReader = sc9.ExecuteReader Do While dr9.ReadResponse.Write("<td style='width:10px'><FONT color=black style='FONT-SIZE: 9pt; FONT-FAMILY: Times New Roman'><A HREF = F:\" & dr9.GetString(0) & " > " & dr.GetString(0) & " </A></font></td>")Loopdr9.Close()cn9.Close()I am currently using Win2k and VB .Net to develop the programe.It would be nice to know how to open a zip file as well and any help wille much more appreaciated. Thanx |
 |
|
|
|
|