Exception Occurs While Opening a Downloaded Excel Sheet(.xls) In Asp.Net -
i download excel sheet using following code. the above code starting code of logic.after downloaded, open excel sheet.it shows warning this because of warning,when im trying upload same page mysql database using asp.net.it shows exception "page not in correct format". this entire logic downloading excel sheet protected void download_click(object sender, eventargs e) { exporttoexcel(sqldatasource1, "studentmarks"); } public void exporttoexcel(sqldatasource datasrc, string filename) { //add response header response.clear(); response.addheader("content-disposition", string.format("attachment;filename={0}.xls", filename)); response.charset = ""; response.contenttype = "application/ms-excel"; //get data database mysqlconnection cn = new mysqlconnection(datasrc.connectionstring); // string query = datasrc.selectcommand.replace("\r\n", " ").re