Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 27th, 2008, 09:55 AM
Authorized User
Join Date: Sep 2006
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to VerbatimBOT Send a message via Yahoo to VerbatimBOT
Default UnauthorizedAccessException when creating Word doc

Hi all,

I'm having troubles with generating Word documents from a predefined Word template. Since I have found on the Net it's not recommended for Word docs to be generated from within ASP.NET app, I have created a small console application which will do the work.
The thing is, when I start this console app manually, it works fine, but when ASP.NET app tries to call it, it returns an UnauthorizedAccessException.

Here is the calling code
        Process objGenDoc = new Process();
        objGenDoc.StartInfo.FileName = Server.MapPath("~/GenerateDocument.exe");


I'ld also like to mention I have no such thing as "Microsoft Word Application" or something similar which would point to Word application in my Component Service (dcomcnfg) from which I could set launching or accessing permissions.

I'm running 64bit Vista, Office 2007 and IIS7.
Word and Office references have been added to web.config file.

Thanks in advance.

Aleksandar Dragosavac
Belgrade, Serbia
Aleksandar Dragosavac
Belgrade, Serbia
Old November 3rd, 2008, 04:32 PM
Registered User
Join Date: Oct 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

  Have you given the permission for aspnet user to access dcom word object if not then try giving

"Computer" -> "My Computer" -> "DCOM config".
Now, search for a "Microsoft Word Document" -> right click ->Properties, Security

Also modify your web.confile file by adding identity tag

<identity impersonate="true" userName="domainName\userName" password="yourPassword" / >

Hope this will help you

Old November 3rd, 2008, 06:56 PM
Authorized User
Join Date: Sep 2006
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to VerbatimBOT Send a message via Yahoo to VerbatimBOT

Hi, thank you for replying.
I've heard about DCOM config settings, but I do not have "Microsoft Word Document" in it. I do have Office 2007 installed though.
The real problem was that Word docs generating code did not work on 64bit Server 2008 for some reason. The exact same code works perfectly well on 64bit Server 2003! Another interesting thing is that it does not work if the app is impersonating a machine local account, but it works if it's impersonating a domain account. Do you know why is that? :)


Aleksandar Dragosavac
Belgrade, Serbia

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating word doc - word behaviour mat41 Classic ASP Professional 2 April 29th, 2007 06:46 PM
Copy text from 1 doc to other doc thru vba in word itchock Word VBA 2 December 29th, 2006 02:47 AM
Creating word doc. thru .dot or XML document manish.sharma04 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 2 March 1st, 2006 07:18 AM
Creating word doc in ASP.NET ghari ASP.NET 1.0 and 1.1 Basics 1 December 10th, 2005 04:01 AM
Copy word to word doc. in VB vamshi Pro VB 6 1 March 24th, 2004 06:25 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.