Dim attachment As String = "attachment; filename=DataReport.xls" Response.ClearContent() Response.AddHeader("content-disposition", attachment) Response.ContentType = "application/ms-excel" Dim sw As StringWriter = New StringWriter() Dim str As String = sb.ToString Response.Write(str.ToString()) Response.Flush() Response.End()
Throw ex