C# – IIS Permissions for Saving Word Documents


Our ASP.NET/C# lets users edit and manage Word (OpenXML) documents that are hosted on a server. I am using client-side VBScript functions to handle some of the editing functions including saving the document to a folder on the server. For the save functionality, I am using the following function call :

Document.SaveAs "http://server/savefolder/savefile.docx" 

I have given "Full Control" permissions on savefolder to both the NETWORK SERVICE and the IUSR_MACHINE users. Yet the above call fails. The error number returned is 5096. The error message is some gibberish that doesn't make any sense.

The server is Windows 2003 and the IIS version is 6.0. I have installed the OpenXML SDK 2.0 CTP on the server.

I can successfully read and print documents.

Does anyone tell me what I am doing wrong? or what additional settings need to be in place?

BTW, the error message ("gibberish" from my post) is:


No, I am not making this up!

Best Solution

In my case, that error 5096 with description "EOALPHABETICARABICARABICABJADARABICALPHABAHTTEXTCAPSCARDTEXTCHARFORMATCHI" occurred when using VBA code in Access to drive a Word mail-merge. The cause was trying to save a document with the same name (including path) as an open document.

Error line:

objApp.ActiveDocument.SaveAs saveAsName 

where objApp is the object variable representing the Word application and saveAsName is the string variable storing the name I am trying to save the file as e.g. "C:\temp\testdoc.docx".

IF a file with the same name exists but is not open, the above code overwrites it silently.