title: Downloading simple text/csv file in Chrome fails
body: <p>I'm trying to figure out a problem that we're facing with the download and the problem seems to exist only in Chrome and only for txt and csv files. Downloading zip files works just as expected. IE and Firefox works for all scenarios.
  For some reason Chrome downloads both txt and csv files without properly setting the name. Files inherit the name of the page which they were downloaded from, and don't have an extension (<img src="https://i.stack.imgur.com/WmsQ3.png" alt="see screenshot">). </p>
  
  <p>I have a simple Webform with just 3 linkbuttons a fairly straightforward code behind, which I simplified for the sake of this question. </p>
  
  <pre><code>Imports System.IO
  
  Public Class _Default
      Inherits Page
  
      Private Const FILE_PATH_CSV As String = "D:\Temp\Download\testFile.csv"
      Private Const FILE_PATH_ZIP As String = "D:\Temp\Download\testFile.zip"
      Private Const FILE_PATH_TXT As String = "D:\Temp\Download\testFile.txt"
  
      Private Sub btnDownloadCSV_Click(sender As Object, e As EventArgs) Handles btnDownloadCSV.Click
          Dim file As New FileInfo(FILE_PATH_CSV)
          If Not file.Exists() Then
              Throw New Exception("No file")
          End If
          Try
              DownloadFile(file)
          Catch ex As Exception
              'TODO: Log!
          End Try
      End Sub
  
      Private Sub btnDownloadTXT_Click(sender As Object, e As EventArgs) Handles btnDownloadTXT.Click
          Dim file As New FileInfo(FILE_PATH_TXT)
          If Not file.Exists() Then
              Throw New Exception("No file")
          End If
          Try
              DownloadFile(file)
          Catch ex As Exception
              'TODO: Log!
          End Try
      End Sub
  
      Private Sub btnDownloadZIP_Click(sender As Object, e As EventArgs) Handles btnDownloadZIP.Click
          Dim file As New FileInfo(FILE_PATH_ZIP)
          If Not file.Exists() Then
              Throw New Exception("No file")
          End If
          Try
              DownloadFile(file)
          Catch ex As Exception
              'TODO: Log!
          Finally
              With Response
                  .Flush()
                  .End()
              End With
          End Try
      End Sub
  
      Private Sub DownloadFile(ByVal file As FileInfo)
          With Response
              .Clear()
              .ClearHeaders()
              .ClearContent()
              .Buffer = True
  
              Response.ContentType = GetContentType(file)
              Response.AddHeader("Content-Disposition:", String.Format("attachment;filename=""{0}""", file.Name.ToString()))
              Response.AddHeader("Content-Length", file.Length.ToString())
              Response.TransmitFile(file.FullName)
          End With
      End Sub
  
      Private Function GetContentType(ByVal file As FileInfo)
          Select Case file.Extension.ToLower()
              Case ".txt", ".csv"
                  Return "application/octet-stream"
              Case ".zip"
                  Return "application/x-zip-compressed"
              Case Else
                  Return "application/octet-stream"
          End Select
      End Function
  End Class
  </code></pre>
  
  <p>I've tried switching the content type to 'text/plain' or other options as I searched the web for the answer but had no luck. I feel like I'm missing something, but I can't find anything that answers my question online.
  Does anyone have any ideas why this might be happening? </p>
  
  <p>Any help is appreciated.</p>