473,513 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Office interop from asp.net (vb) - permissions problem....

Stu
Hi,

I am trying to open a word document from an asp.net page but I keep getting
an access denied error when I try to create an instance of the word
applications.

I have created references to the Office 11.0 Object and it imported the
other references (except stdole which I did manually)

I have imported namepsaces:

Imports System.ComponentModel
Imports Microsoft.Office.Interop

The code I am calling is:

Dim oWordApp As Word.Application
Dim oWordDoc As Word.Document
oWordApp = New Word.Application '<<<<<<<<<<<<<<<<< ERROR
oWordDoc = oWordApp.Documents.Open("c:\text.doc")

The error below says I should give access permission to the ASPNET user. But
a) that user does not exist on my machine - I think it is 'Authenticated
user' that I need and b) which file needs to be given permission?!? I have
tried giving this user full control over the entire Office folder (not
something I'd do on a production server), but no go!

Does anyone know which file needs permission? Any other suggestions?

Thanks in advance,

Stuart
================================================== ==================
The error:
Access is denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the
boxes for the desired access.
Nov 19 '05 #1
3 2274
No. ASPNET is a restricted account that's somewhat like "guest" account. It
cannot be used to execute anything outside your web process.

Instead, you should try to "impersonate"(Google for this keyword for usage)
a real "user" account, and give the "user" permission to that directory too,
of course.

"Stu" <s.****@cergis.com> ¼¶¼g©ó¶l¥ó·s»D:OT**************@TK2MSFTNGP12.phx.g bl...
Hi,

I am trying to open a word document from an asp.net page but I keep
getting an access denied error when I try to create an instance of the
word applications.

I have created references to the Office 11.0 Object and it imported the
other references (except stdole which I did manually)

I have imported namepsaces:

Imports System.ComponentModel
Imports Microsoft.Office.Interop

The code I am calling is:

Dim oWordApp As Word.Application
Dim oWordDoc As Word.Document
oWordApp = New Word.Application '<<<<<<<<<<<<<<<<< ERROR
oWordDoc = oWordApp.Documents.Open("c:\text.doc")

The error below says I should give access permission to the ASPNET user.
But a) that user does not exist on my machine - I think it is
'Authenticated user' that I need and b) which file needs to be given
permission?!? I have tried giving this user full control over the entire
Office folder (not something I'd do on a production server), but no go!

Does anyone know which file needs permission? Any other suggestions?

Thanks in advance,

Stuart
================================================== ==================
The error:
Access is denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
or Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the
boxes for the desired access.

Nov 19 '05 #2
Stu
Many thanks - that did the trick.

Stu

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl...
No. ASPNET is a restricted account that's somewhat like "guest" account.
It cannot be used to execute anything outside your web process.

Instead, you should try to "impersonate"(Google for this keyword for
usage) a real "user" account, and give the "user" permission to that
directory too, of course.

"Stu" <s.****@cergis.com>
¼¶¼g©ó¶l¥ó·s»D:OT**************@TK2MSFTNGP12.phx.g bl...
Hi,

I am trying to open a word document from an asp.net page but I keep
getting an access denied error when I try to create an instance of the
word applications.

I have created references to the Office 11.0 Object and it imported the
other references (except stdole which I did manually)

I have imported namepsaces:

Imports System.ComponentModel
Imports Microsoft.Office.Interop

The code I am calling is:

Dim oWordApp As Word.Application
Dim oWordDoc As Word.Document
oWordApp = New Word.Application '<<<<<<<<<<<<<<<<< ERROR
oWordDoc = oWordApp.Documents.Open("c:\text.doc")

The error below says I should give access permission to the ASPNET user.
But a) that user does not exist on my machine - I think it is
'Authenticated user' that I need and b) which file needs to be given
permission?!? I have tried giving this user full control over the entire
Office folder (not something I'd do on a production server), but no go!

Does anyone know which file needs permission? Any other suggestions?

Thanks in advance,

Stuart
================================================== ==================
The error:
Access is denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
or Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in
Explorer, choose "Properties" and select the Security tab. Click "Add" to
add the appropriate user or group. Highlight the ASP.NET account, and
check the boxes for the desired access.


Nov 19 '05 #3
Stu
Many thanks - that did the trick.

Stu

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl...
No. ASPNET is a restricted account that's somewhat like "guest" account.
It cannot be used to execute anything outside your web process.

Instead, you should try to "impersonate"(Google for this keyword for
usage) a real "user" account, and give the "user" permission to that
directory too, of course.

"Stu" <s.****@cergis.com>
¼¶¼g©ó¶l¥ó·s»D:OT**************@TK2MSFTNGP12.phx.g bl...
Hi,

I am trying to open a word document from an asp.net page but I keep
getting an access denied error when I try to create an instance of the
word applications.

I have created references to the Office 11.0 Object and it imported the
other references (except stdole which I did manually)

I have imported namepsaces:

Imports System.ComponentModel
Imports Microsoft.Office.Interop

The code I am calling is:

Dim oWordApp As Word.Application
Dim oWordDoc As Word.Document
oWordApp = New Word.Application '<<<<<<<<<<<<<<<<< ERROR
oWordDoc = oWordApp.Documents.Open("c:\text.doc")

The error below says I should give access permission to the ASPNET user.
But a) that user does not exist on my machine - I think it is
'Authenticated user' that I need and b) which file needs to be given
permission?!? I have tried giving this user full control over the entire
Office folder (not something I'd do on a production server), but no go!

Does anyone know which file needs permission? Any other suggestions?

Thanks in advance,

Stuart
================================================== ==================
The error:
Access is denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
or Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in
Explorer, choose "Properties" and select the Security tab. Click "Add" to
add the appropriate user or group. Highlight the ASP.NET account, and
check the boxes for the desired access.


Nov 19 '05 #4

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

Similar topics

8
8173
by: | last post by:
Hi All, I'm tring to write an application which open .xls files and get information from them ( using .xls file as a database ). According to the MSDN ( http://support.microsoft.com/default.aspx?scid=kb;EN-US;302094 ) I must add Microsoft Excel Object Library as an reference OK It works fine ... but when I place the line
2
2430
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability, where I declare objects as follows: Dim oWordApp As New Microsoft.Office.Interop.Word.Application, after adding a reference to...
2
11439
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability, where, after adding a reference to Microsoft.Office.Core and a reference to Microsoft Word I declare objects as follows: Dim oWordApp As New...
5
3606
by: John | last post by:
Hi I need to call methods from office apps from my vb.net app. Some of my clients are still on office 2000 so to maintain compatibility I can not use office 2003 PIA. Can I avoid the whole PIA route by using late binding? Could someone please give me an example of using late binding for calling office apps? Thanks
1
3563
by: Tory Collum | last post by:
My code works as a VB.NET executable file. So I'm trying to "adapt" it to a ..NET XML Web Service. As a VB.NET file, I used Microsoft.Office.Core as the reference, and everything was fine, but when I try to do the same thing as an XML Web Service, VS.NET says my syntax is not defined. Can anyone tell me why the syntax is not defined? ...
5
49763
by: Michael Russell | last post by:
Hi all, Using C#, I've created a simple wrapper class for using Excel. I have Office Pro 2003 installed on my devel machine. The wrapper class works great, reading and writing to/from Excel. To do this, I created a reference to "Microsoft Excel 11.0 Object Library", and have a "using Excel;" directive. I decided to add a method for...
2
7267
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a "Array index out of bounds". Microsoft.Office.Interop.Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.ApplicationClass();...
0
4094
by: Bill Fallon | last post by:
I am developing a VB.Net application with VS 2005 that opens an Excel workbook and populates the worksheet with data. I started developing the application with Office 2007 installed on my Vista OS, but after I discovered that it won't run on a system with Office 2003, I uninstalled Office 2007 and installed Office 2003. I reset the reference...
0
3579
by: frederick.the.fool | last post by:
I'm writing a project that does Visio automation. I'm writing it in C+ +/CLI because it needs to reference a good amount of native C++ code. One way to call the Visio API, of course, is to use the COM interface provided in Visio SDK. However, a colleague of mine has been using Microsoft.Office.Interop.Visio in his VB.NET project, which is...
0
7269
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7559
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7123
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.