HttpContext.Current.Response.ClearContents() HttpContext.Current.Response.Clear() HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;Filename=" & _filename & "") HttpContext.Current.Response.ContentType = "application/vnd.ms-excel" HttpContext.Current.Response.Write(tw.ToString()) HttpContext.Current.Response.Flush() HttpContext.Current.Response.End()