Hi all,
some strange things are going on.
I have a c# project to automate word written under VS.NET with Office
XP PIAs. It is a web application project using ASP.NET, programming language
is c#.
Office Version 2002 (Microsoft Word 10.0 Object Library version 8.2).
All works fine.
I switched me local machine and also the environment. The same project don't
work on with VS.NET 2003. Googeling helps, in VS.NET 2003 I must remove
"using Word = Microsoft.Office.Interop.Word;". I was wondering that I also
have to change some code, e.g.
oTable.Columns[1] is now oTable.Columns.Item(1)
oDoc.Bookmarks.get_Item is now oDoc.Bookmarks.Item
and so on ...
Not nice to change exist code, but ok. After changing the project, it
compiled without an error. Now i come to the sticky thing! Requesting the
page caused an exception. Access denied.
Source Error points to the following line (Full stack trace can you find at
the end):
Line 26: oWord = new Word.Application();
I have tried the suggestion from the error page (grant asp.net write access,
....) without any luck. I have also tried it with the administrator account!
Googeling again show me a lot of hints, but no solution work for me.
- using DCOMCNFG tool
- changing ASPNET user privilege
- ...
Last try was to install Office Version 2003 and after installing (no reboot
after installation!) it seems to work perfect. Yeah, the luck is back. But
my first impression was false. After rebooting my maschine, I get the same
exception: Access is denied.
I'm frustrated. But hopefully that anyone can help me.
Does anyone can explain me, what is going (wr) on (g).
Thx in advance.
Michael
Appendix:
Stack Trace:
[UnauthorizedAccessException: Access is denied.]
WebQuote.document.doc() in d:\inetpub\wwwroot\webquote\document.cs:26
WebQuote.start.Step3() in d:\inetpub\wwwroot\webquote\start.aspx.cs:110
WebQuote.start.SiteProcessing() in
d:\inetpub\wwwroot\webquote\start.aspx.cs:129
WebQuote.start.cmdProcess_Click(Object sender, EventArgs e) in
d:\inetpub\wwwroot\webquote\start.aspx.cs:260
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277