I have an asp.net page in which I have a gridview and a button. On button click event I have wrote the code which exports the gridview to excel which is working very fine. But when I try to open that exported excel file it shows a dialog box saying:
"The file you are trying to open is in a different format than specified by the file extension.Verify that the file is not corrupted and is from a trusted source before opening the file".
Not only that, i sent that excel file as attachment in gmail and tried to open it in mobile, at that time it opens as an html file.What can I do for this because my client will be using mobile to view mails.