File Download

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I have a simple file download button that when clicked opens a window with a
file download dialog prompting a user to save in csv or xls format. The code
works fine locally. (In debug mode there is an exception thrown on the
response.end line) but once on the server the page displays and then closes
immediately. Below is the relevant code. Has anyone encountered this before?

Response.Clear()
HttpContext.Current.Response.BufferOutput = True
HttpContext.Current.Response.AppendHeader("Content-Disposition",
String.Format("attachment; filename={0}", fileName))
HttpContext.Current.Response.ContentType = outType
Dim encoding As New System.Text.ASCIIEncoding
HttpContext.Current.Response.BinaryWrite(encoding.GetBytes(outString))
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()

.



Relevant Pages

  • File Downloads
    ... file download dialog prompting a user to save in csv or xls format. ... Below is the relevant code. ...
    (microsoft.public.dotnet.general)
  • File Download Dialog
    ... I can't seem to get the file download dialog to appear, ... All that happens is that the csv text ... Pat Buxton ...
    (php.general)
  • File Download dialog problem
    ... I can't seem to get the file download dialog to appear, ... $csv = array; ... Pat Buxton ...
    (alt.php)