Access denied...

  • Thread starter Thread starter Kagamoto
  • Start date Start date
K

Kagamoto

Hello everybody!

I'm developing an ASP.NET (v1.1) web application which includes a
reference to the "Microsoft Word 11.0 Object Library".

When I try the following code:

....
....
Microsoft.Office.Interop.Word.Application app = new
Word.ApplicationClass();
....
....

I get an ASP.NET Error "System.UnauthorizedAccessException: Access
denied"

What can be the problem?

Thanks in advance!
Bye
 
When Word starts for the first time for a user it pops up a message box
asking your name and initials. When you start Word via your anonymous user
it will probably be popping the box up. The web service doesn't have access
to the desktop so you'll be getting the permission denied error.

You could temporarily allow the WWW service and the anon user access to the
desktop to allow you to complete the Word start-up process. However ideally
you shouldn't use Word (or any Office App) from asp.net as they are not
coded to be web suitable.
 
Ok, I've solved.

a)
Run DCOMCNFG.EXE , select Word Application - Properties - select
Security and add ASPNET to the Launch and Access permissions list.

or

b)
add <identity impersonate="true"/> to web.config


Thanks!
 
I'm developing an ASP.NET (v1.1) web application which includes a
reference to the "Microsoft Word 11.0 Object Library".

You'd be well advised not to even try to do this. Server-side instatiation
of Microsoft Office is to be avoided if at all possible - even Microsoft
strongly advise against it to the extent where they won't actually support
any solution which uses it...
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

Use this instead:
http://www.aspose.com/Products/Aspose.Words/Default.aspx

And have a read of this too:
http://www.aspose.com/wiki/default.aspx/Aspose.Total/WhyNotAutomation.html
 
Back
Top