File Download in Chrome appears incorrect file name [PageName].aspx. It worked before I updated my Chrome
===

This is a asp.net 3.5 website.

Files can be download correctly in IE/FF. But not chrome.

The file is downloaded as "ASPS_Page_Name.aspx".

However it worked before I updated my chrome browser to 20.0.1132.47 m.

I have this function to filter out MIME types (intended for ff, the previous chrome doesn't need this funtion)

    Private Shared Function GetContentType(ByVal fileType As String) As String

        Select Case fileType

            'set to "application/vnd.ms-excel" MIME type for firefox
            'MIME Types for IIS
            Case "xls"
                Return "application/vnd.ms-excel"

            Case "xlsx"
                Return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

            Case "pdf"
                Return "application/pdf"

            Case "doc"
                Return "application/msword"

            Case "docx"
                Return "application/vnd.openxmlformats-officedocument.wordprocessingml.document"

            Case "ppt"
                Return "application/vnd.ms-powerpoint"

            Case "pptx"
                Return "application/vnd.openxmlformats-officedocument.presentationml.presentation"

            Case Else
                Return "application/octet-stream"

        End Select

    End Function

At this moment, with this function xls/xlsx/pdf/.. files can be downloaded with correct name, I'm wondering whether I need to specify the all mime types here or in web.config to make the download work.

Does everyone know what happened to chrome and how to fix this "bug"?

This is the download function, should be ok caz it works before.

    Public Shared Sub StreamFileToClient(ByVal memoryStream As IO.MemoryStream, ByVal fileName As String, ByVal fileType As String)

        Try

            memoryStream.Position = 0

            'Serve to client
            System.Web.HttpContext.Current.Response.ClearHeaders()
            System.Web.HttpContext.Current.Response.ClearContent()

            System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;attachment; filename=" & fileName & "." & fileType)
            System.Web.HttpContext.Current.Response.AddHeader("Content-Length", memoryStream.Length.ToString())
            System.Web.HttpContext.Current.Response.ContentType = GetContentType(fileType)

            'octet-stream";
            System.Web.HttpContext.Current.Response.BinaryWrite(memoryStream.ToArray)
            'System.Web.HttpContext.Current.Response.Flush()
            'well good to use completerequest rather than .end nand .close. Read MSDN.
            'System.Web.HttpContext.Current.Response.End()
            'System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest()


        Catch ex As Exception


        Finally
            System.Web.HttpContext.Current.Response.Flush()
            System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest()


            memoryStream.Flush()
            memoryStream.Dispose()

        End Try

    End Sub