Try this but sorry its in VB: Dim strFolderPath As String = AppDomain.CurrentDomain.BaseDirectory() & "02\TMCoverageArea\" Dim strFilePath As String strFilePath = strFolderPath & hlkCoverageArea.Text DownloadFile(strFilePath, True) Private Sub DownloadFile(ByVal FilePath As String, ByVal ForceToDownload As Boolean) 'Dim path As Path Dim strFullFilePath = IO.Path.GetFullPath(FilePath) Dim strFileName = IO.Path.GetFileName(strFullFilePath) Dim strExtension = IO.Path.GetExtension(strFullFilePath) Dim strFileType As String = "" If Not IsDBNull(strExtension) Then strExtension = LCase(strExtension) End If strFileType = GetFileTypeFromExtension(strExtension) If (ForceToDownload) Then Response.AppendHeader("content-disposition", _ "attachment; filename=" + strFileName) End If If strFileType <> "" Then Response.ContentType = strFileType End If Response.WriteFile(strFullFilePath) Response.End() End Sub Public Function GetFileTypeFromExtension(ByVal FileExtension As String) As String Try Dim strFileType As String = "" Select Case FileExtension Case ".htm", ".html" strFileType = "text/HTML" Case ".txt" strFileType = "text/plain" Case ".doc", ".rtf" strFileType = "Application/msword" Case ".csv", ".xls" strFileType = "Application/x-msexcel" Case Else strFileType = "text/plain" End Select Return strFileType Catch ex As Exception End Try End Function