views:

16

answers:

0

(C#, ASP.NET 3.5 Environment) I'm using Microsoft's DSOFile.dll for counting the pages in a word document (.doc format). When I deployed my application to a medium trust environment (GoDaddy) I got a security exception. I narrowed my web service down to the line which is causing the problem, and it looks like it takes place in the following code block:

DSOFile.SummaryProperties props;
       DSOFile.OleDocumentPropertiesClass mDoc = new DSOFile.OleDocumentPropertiesClass();
    mDoc.Open(ActualPath, true, DSOFile.dsoFileOpenOptions.dsoOptionDefault);
    props = mDoc.SummaryProperties;
    Pages = props.PageCount;

It gives me the security exception so long as the third line (mDoc.Open) is in there. When commented out, the file acts normally, and while it doesn't give counts for .doc files, it does count the other types of files i have cases set up for. I thought it may have something to do with Absolute vs Relative paths, but then I noticed that even when debugging locally (after setting my trust level in my app to Medium) it crashed without actually running any methods, and simply as a result of that line being in there. So, obviously Medium Trust and this method of file I/O don't work. This behavior is the same for my web service (through SOAP and JSON) as well as on a test ASP.NET page I created. Does anyone know of an alternative method for achieving what I want to do in a Medium Trust environment?