A
Ayrin
The code below works fine on my Windows2003, dotnet 1.1 server. UNTIL I
install service pak one for Windows 2003.
After I install SP1 this code brings up the Open/save box but one you select
something, nothing happens (0% downloads)
If I run this code on my dev machine with winXPsp2 and IE7, the code only
works for text files. Other files will download, but they are corrupt when
I open them.(missing bytes I think)
Does anyone have this working with a fully patch 03 server? How?
Thanks,
Ayrin
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim path2 As String
Try
path2 = Request.Params("File")
path2 = "C:\Attachments\" & path2
Dim file As System.IO.FileInfo = New System.IO.FileInfo(path2)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.AddHeader("Content-Disposition",
"attachment;filename=" + file.Name)
Response.AddHeader("Content-Length", file.Length.ToString)
Select Case file.Extension
Case ".xls"
Response.ContentType = "application/vnd.ms-excel"
HttpContext.Current.Response.WriteFile(file.FullName)
Case ".pdf"
Response.ContentType = "x-application/pdf"
HttpContext.Current.Response.WriteFile(file.FullName)
Case Else
Response.ContentType = "application/octet-stream"
HttpContext.Current.Response.WriteFile(file.FullName)
End Select
Response.End()
Catch ex As Exception
Label1.Text = "Path: " & path2 & " Message: " & ex.Message
End Try
End Sub
install service pak one for Windows 2003.
After I install SP1 this code brings up the Open/save box but one you select
something, nothing happens (0% downloads)
If I run this code on my dev machine with winXPsp2 and IE7, the code only
works for text files. Other files will download, but they are corrupt when
I open them.(missing bytes I think)
Does anyone have this working with a fully patch 03 server? How?
Thanks,
Ayrin
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim path2 As String
Try
path2 = Request.Params("File")
path2 = "C:\Attachments\" & path2
Dim file As System.IO.FileInfo = New System.IO.FileInfo(path2)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.AddHeader("Content-Disposition",
"attachment;filename=" + file.Name)
Response.AddHeader("Content-Length", file.Length.ToString)
Select Case file.Extension
Case ".xls"
Response.ContentType = "application/vnd.ms-excel"
HttpContext.Current.Response.WriteFile(file.FullName)
Case ".pdf"
Response.ContentType = "x-application/pdf"
HttpContext.Current.Response.WriteFile(file.FullName)
Case Else
Response.ContentType = "application/octet-stream"
HttpContext.Current.Response.WriteFile(file.FullName)
End Select
Response.End()
Catch ex As Exception
Label1.Text = "Path: " & path2 & " Message: " & ex.Message
End Try
End Sub