I have excel 2016. When I try to save excel file through code it showing a warning message as
"The file format and extension of 'ReviewCounts.xls' don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?"
After clicking Yes
it has been opened. How to avoid that popup ?
My code:
Dim attachment As String = "attachment; filename=ReviewCounts.xls"
Response.ClearContent()
Response.AddHeader("content-disposition", attachment)
Response.ContentType = "application/ms-excel"
Dim strexcelExport As String = String.Empty
ExportReviewDetails(strexcelExport, "Excel") 'Method to prepare excel
Response.Write(strexcelExport)
Response.End()
I tried with .xlsx format also but in this case file not even saved.