Link to home
Start Free TrialLog in
Avatar of zimmer9
zimmer9Flag for United States of America

asked on

In ASP.NET 4.0 using C#, how would you prevent READ-ONLY status when creating an Excel 2003 file by exporting records from GridView?

I'm writing my first ASP.NET 4.0 application using C# with VS2010.

I am trying to export a stored procedure result set to an Excel 2003 file.

When I create the new Excel file, I notice that the title bar states that it is READ-ONLY.

Do you know how I can modify my following code to get rid of the READ-ONLY status on the Excel file?

My code is in the attachment:
----------------------------
ExcelExport.txt
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

As this file is considered "downloaded" for security reasons it is marked as read only. Try adding this site to trusted sites section in your browser( still I think it might not work and make the file read only)
Avatar of Johny Bravo
Johny Bravo

Try this,

var fInfo = new FileInfo(YourFilePathName );
fInfo.IsReadOnly = false;
ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial