views:

29

answers:

1

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!

A: 

Try inspecting the permissions that the application is using to run with an util such as Process Explorer from Microsoft/SysInernals. There you can see if although the application is running with some user, a mechanism like UAC is lowering the priviledges. If that's the case, you may need to make the application support UAC.

You may also attempt using Process Monitor to understand how the access to the file is being tried and why WRITE call is failing. Sometimes error messages from COMExceptions may be misleading.

Best of luck!

Miguel Ventura
Thanks for the suggestions. The only knowledge I gained from PE and PM was that all processes are being run under my user name (I am Admin). I even disabled UAC completely, to no avail. Could my D: drive somehow be "protected" by the OS?One interesting event: WinServer would not let me read the compiled HTML help for PE and PM. It opened the UI and showed all of the contents, but would not show any HTML - "Navigation to the webpage was cancelled" - even though I was running it out of my own downloads folder. Could this be relevant?
Tom