473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Opening MS Word from a VB.NET ASP Page Access Denied

Hi,

Being fairly new to .NET I am looking for a way to call
MS
Word from an event on a webform, and after the user is
finished save that created document to an SQL Server
database. Has anyone done this? Does it seem possible? I
followed the instructions from a sample on the Microsoft
knowledge base but it only seems to work when creating a
VB.NET Windows .EXE, not an VB.NET ASP app.

Imports Word=Microsoft.Office.Interop.Word

Dim oWord As Word.Application
Dim oDoc As Word.Document
'Start Word and open the document template.
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add

I changed the sample code to the following:

Dim oWord As Word.ApplicationClass
Dim oDoc As Word.DocumentClass
'Start Word and open the document template.
oWord = New Word.ApplicationClass()
oWord.Visible = True
oDoc = oWord.Documents.Add

But when i build the solution it gives me the following
error:

Access Denied

Exception Details: System.UnauthorizedAccessException:
Access is denied.

The ASP.NET process is not authorized to access the
request. For security reasons the default ASP.NET process
is '{machinename}\ASPNET' which has limited privileges.
Consider granting access rights to the resource to the
ASP.NET process identity.

Line 31: oWord = New Word.ApplicationClass()

But it does not specify what it is trying to gain access
to. I tried giving the asp account admin rights just to
test but that didnt work. I also lowered to security
settings on IE to test as well, and I gave the ASPNET
account full access to the
Microsoft.Office.Interop.Word.dll.

Any ideas?

Thanks.
Nov 18 '05 #1
3 6093
This is cut and paste from previous discussion.

Rule of thumb: NO server-side ms office api calls because
it renders your server unstable and insecure. Plus
Microsoft does not allow server-side thru very restrictive
licensing. You are limited to client-side activeX calls
from your browser like below. Check that out. Also read
the links I enclosed further down in the discussion.

Good luck,
Yuri
. Reply (E-mail) Forward (E-mail)

Subject: Re: Client-side Word Automation from asp.net
From: "an*******@discussions.microsoft.com"
<an*******@discussions.microsoft.com> Sent: 12/3/2003
11:25:41 AM


Thanks Steve! This should get it started:

<script language="javascript">
var word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Add("Normal", false, 0);
var range = word.ActiveDocument.Range(0, 0);
range.InsertBefore("hey testing this");
range.Font.Name = "Arial";
range.Font.Size = 24;
range.InsertParagraphAfter();
//var pause = 0;
//var nopause = 1;
//var wdDialogFileOpen = 80;
//var wdDialogToolsOptionsSpellingAndGrammar = 203;
//var dialog = word.Dialogs
(wdDialogToolsOptionsSpellingAndGrammar);
//var button = dialog.Show(1);

//word.ActiveDocument.CheckGrammar();
//word.ActiveDocument.CheckSpelling();
//word.ActiveDocument.SaveAs("Mydoc.txt", 4);
word.Quit();
</script>
-----Original Message-----
Take a look at the client side example in this article (near the end):http://www.aspnetpro.com/NewsletterA...003/09/asp2003 09so_l/asp200309so_l.asp
The example uses Excel but it should still be helpful to you.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able- consulting.com

"Yuri Vanzine" <yp*@tft.com> wrote in message
news:1a****************************@phx.gbl...
In asp we can run VBSCRIPT client-side which allows
for 'easy' :?) ms office COM object instantiation. How do I access a Word object in ASP.NET on the client side?

I would like to do spell checking from a web-based wysiwyg editor and I am limited to using ms word from the client, server-side word automation is out of the question for
several important reasons
(http://support.microsoft.com/default.aspx?
scid=http://support.microsoft.com:80/support/kb/articles/Q2 57/7/57.asp&NoWebContent=1) . Although this
(http://www.codeproject.com/aspnet/wordapplication.asp)
article helps a little bit.

Any help will be appreciated!

Thanks,

yv

.

..

-----Original Message-----
Hi,

Being fairly new to .NET I am looking for a way to call
MS
Word from an event on a webform, and after the user is
finished save that created document to an SQL Server
database. Has anyone done this? Does it seem possible? I
followed the instructions from a sample on the Microsoft
knowledge base but it only seems to work when creating a
VB.NET Windows .EXE, not an VB.NET ASP app.

Imports Word=Microsoft.Office.Interop.Word

Dim oWord As Word.Application
Dim oDoc As Word.Document
'Start Word and open the document template.
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add

I changed the sample code to the following:

Dim oWord As Word.ApplicationClass
Dim oDoc As Word.DocumentClass
'Start Word and open the document template.
oWord = New Word.ApplicationClass()
oWord.Visible = True
oDoc = oWord.Documents.Add

But when i build the solution it gives me the following
error:

Access Denied

Exception Details: System.UnauthorizedAccessException:
Access is denied.

The ASP.NET process is not authorized to access the
request. For security reasons the default ASP.NET process
is '{machinename}\ASPNET' which has limited privileges.
Consider granting access rights to the resource to the
ASP.NET process identity.

Line 31: oWord = New Word.ApplicationClass()

But it does not specify what it is trying to gain access
to. I tried giving the asp account admin rights just to
test but that didnt work. I also lowered to security
settings on IE to test as well, and I gave the ASPNET
account full access to the
Microsoft.Office.Interop.Word.dll.

Any ideas?

Thanks.
.

Nov 18 '05 #2
Thanks!
-----Original Message-----
This is cut and paste from previous discussion.

Rule of thumb: NO server-side ms office api calls becauseit renders your server unstable and insecure. Plus
Microsoft does not allow server-side thru very restrictivelicensing. You are limited to client-side activeX calls
from your browser like below. Check that out. Also read
the links I enclosed further down in the discussion.

Good luck,
Yuri
. Reply (E-mail) Forward (E-mail)

Subject: Re: Client-side Word Automation from asp.net
From: "an*******@discussions.microsoft.com"
<an*******@discussions.microsoft.com> Sent: 12/3/2003
11:25:41 AM


Thanks Steve! This should get it started:

<script language="javascript">
var word = new ActiveXObject("Word.Application");
word.Visible = true;
word.Documents.Add("Normal", false, 0);
var range = word.ActiveDocument.Range(0, 0);
range.InsertBefore("hey testing this");
range.Font.Name = "Arial";
range.Font.Size = 24;
range.InsertParagraphAfter();
//var pause = 0;
//var nopause = 1;
//var wdDialogFileOpen = 80;
//var wdDialogToolsOptionsSpellingAndGrammar = 203; //var dialog = word.Dialogs
(wdDialogToolsOptionsSpellingAndGrammar);
//var button = dialog.Show(1);

//word.ActiveDocument.CheckGrammar();
//word.ActiveDocument.CheckSpelling();
//word.ActiveDocument.SaveAs("Mydoc.txt", 4);
word.Quit();
</script>
-----Original Message-----
Take a look at the client side example in this article(near the end):
http://www.aspnetpro.com/NewsletterA.../2003/09/asp20 0309so_l/asp200309so_l.asp

The example uses Excel but it should still be helpful to
you.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Yuri Vanzine" <yp*@tft.com> wrote in message
news:1a****************************@phx.gbl...
In asp we can run VBSCRIPT client-side which allows
for 'easy' :?) ms office COM object instantiation. Howdo I access a Word object in ASP.NET on the client side?

I would like to do spell checking from a web-basedwysiwyg editor and I am limited to using ms word from theclient, server-side word automation is out of the question for
several important reasons
(http://support.microsoft.com/default.aspx?

scid=http://support.microsoft.com:80/support/kb/articles/

Q2 57/7/57.asp&NoWebContent=1) . Although this
(http://www.codeproject.com/aspnet/wordapplication.asp) article helps a little bit.

Any help will be appreciated!

Thanks,

yv

.

..

-----Original Message-----
Hi,

Being fairly new to .NET I am looking for a way to call
MS
Word from an event on a webform, and after the user is
finished save that created document to an SQL Server
database. Has anyone done this? Does it seem possible?

Ifollowed the instructions from a sample on the Microsoftknowledge base but it only seems to work when creating aVB.NET Windows .EXE, not an VB.NET ASP app.

Imports Word=Microsoft.Office.Interop.Word

Dim oWord As Word.Application
Dim oDoc As Word.Document
'Start Word and open the document template.
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add

I changed the sample code to the following:

Dim oWord As Word.ApplicationClass
Dim oDoc As Word.DocumentClass
'Start Word and open the document template.
oWord = New Word.ApplicationClass()
oWord.Visible = True
oDoc = oWord.Documents.Add

But when i build the solution it gives me the following
error:

Access Denied

Exception Details: System.UnauthorizedAccessException:
Access is denied.

The ASP.NET process is not authorized to access the
request. For security reasons the default ASP.NET processis '{machinename}\ASPNET' which has limited privileges.Consider granting access rights to the resource to the
ASP.NET process identity.

Line 31: oWord = New Word.ApplicationClass()

But it does not specify what it is trying to gain accessto. I tried giving the asp account admin rights just totest but that didnt work. I also lowered to security
settings on IE to test as well, and I gave the ASPNET
account full access to the
Microsoft.Office.Interop.Word.dll.

Any ideas?

Thanks.
.

.

Nov 18 '05 #3
I ran into the same problem. As indicated by the error message, you
need to open Word from an account that has sufficient privileges on
the server machine.

Open the IIS manager and open the properties dialog for your web
directory. On the Directory Security tab click the Edit button for the
"Anonymous Access and Authentication Control" area.

Again click the Edit button under "Anonymous Access". This will give
you a dialog window where you can change the account to one that has
the correct level of permissions.

Robert

On Thu, 4 Dec 2003 09:51:09 -0800, "Yohancef Chin"
<an*******@discussions.microsoft.com> wrote:
Hi,

Being fairly new to .NET I am looking for a way to call
MS
Word from an event on a webform, and after the user is
finished save that created document to an SQL Server
database. Has anyone done this? Does it seem possible? I
followed the instructions from a sample on the Microsoft
knowledge base but it only seems to work when creating a
VB.NET Windows .EXE, not an VB.NET ASP app.

Imports Word=Microsoft.Office.Interop.Word

Dim oWord As Word.Application
Dim oDoc As Word.Document
'Start Word and open the document template.
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add

I changed the sample code to the following:

Dim oWord As Word.ApplicationClass
Dim oDoc As Word.DocumentClass
'Start Word and open the document template.
oWord = New Word.ApplicationClass()
oWord.Visible = True
oDoc = oWord.Documents.Add

But when i build the solution it gives me the following
error:

Access Denied

Exception Details: System.UnauthorizedAccessException:
Access is denied.

The ASP.NET process is not authorized to access the
request. For security reasons the default ASP.NET process
is '{machinename}\ASPNET' which has limited privileges.
Consider granting access rights to the resource to the
ASP.NET process identity.

Line 31: oWord = New Word.ApplicationClass()

But it does not specify what it is trying to gain access
to. I tried giving the asp account admin rights just to
test but that didnt work. I also lowered to security
settings on IE to test as well, and I gave the ASPNET
account full access to the
Microsoft.Office.Interop.Word.dll.

Any ideas?

Thanks.


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
1
by: matthew rutherford via .NET 247 | last post by:
When I use the word automation object (registered word10 andusing the namespace in the .cs file) I get 'access denied' error when trying to run the thing on mylocal pc. I am using the ASPNET user....
4
by: Mark | last post by:
I have been having a very difficult time trying to open a word document in ASP.NET. I have searched here and Google, with no success in finding answers to my problems. Although many articles say...
3
by: Michael Tkachev | last post by:
Hi Everybody! I have a problem. When I get a HTML of my page that I'm rendering. I need to generate a word-document from a html. And than I have to send this word-document to the users through...
1
by: mr net | last post by:
Hi, I'm trying to write: Dim objWord As New Word.Application in the codebehind page but I'm getting the error written below. The question is what is the correct way to use word or any other...
0
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
0
by: sebnunes | last post by:
Hi all, I know this problem has been discussed many times but I've read different post about this problem and none could answer mine. I'm trying to use Word automation from an asp .net web...
0
by: royan | last post by:
Help please! I have the same problem which this post ...
1
by: vin4tony | last post by:
Anyone plz help to open a word document using asp.net.I used a code ..but it shown access denied...Can anyone help me.. my error is Access is denied. Description: An unhandled exception occurred...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.