Open different content type of files. vb.net

              Dim dotPosition As Integer = filePath.LastIndexOf(“.”)

                Dim filenameOnly As String = filePath.Substring(dotPosition + 1)

                Select Case filenameOnly
                    Case “zip”
                        Response.ContentType = “application/x-zip-compressed”
                    Case “pdf”
                        Response.ContentType = “application/pdf”
                    Case “csv”
                        Response.ContentType = “application/csv”
                    Case “doc”
                        Response.ContentType = “application/doc”
                    Case “docx”
                        Response.ContentType = “application/docx”
                    Case “xls”
                        Response.ContentType = “application/xls”
                    Case “xlsx”
                        Response.ContentType = “application/xlsx”
                    Case “png”
                        Response.ContentType = “application/png”
                    Case “gif”
                        Response.ContentType = “application/gif”
                    Case “jpg”
                        Response.ContentType = “application/jpg”
                    Case “csv”
                        Response.ContentType = “application/csv”
                    Case “txt”
                        Response.ContentType = “application/txt”
                End Select

引文来源  Open different content type of files. vb.net