Download breaks after win03 SP1 install

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top