Programmatically modifying a file on Windows Server 2008 (Web Ed.)
        Posted  
        
            by Tom
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Tom
        
        
        
        Published on 2009-11-23T23:39:28Z
        Indexed on 
            2010/03/13
            6:05 UTC
        
        
        Read the original article
        Hit count: 433
        
visual-studio-2008
|filesystems
I have written a .NET 2008 application, incorporating Microsoft.Office.Interop.Excel, that modifies an existing Excel 2007 spreadsheet. It works perfectly on my WinXP development computer.
When I upload the app to a Microsoft Web Server 2008, it opens the file and reads from the file, but when the app tries to save the file, it throws this exception:
"System.Runtime.InteropServices.COMException (0x800A03EC): 'july2009.xlsx' is read-only. To save a copy, click OK, then give the workbook a new name in the Save As dialog box."
The file is NOT read-only, nor is it opened by any other user or app. The app and the Excel file both reside on the D: (data-only) drive. My first instinct was to look at file permissions. When nothing else worked, I literally created a temporary Group, added EVERY user and security entity to it and granted the group full control of the entire D: drive. No luck.
Then I tried manually elevating the permission by running my app as administrator. No luck.
Finally, I copied the file to my XP development computer and ran the app there. Of course it worked perfectly.
Can anyone please tell me how to give my program permission to edit a file on Server 2008?
Thanks!
© Stack Overflow or respective owner