Hi
In one of our ASP.NET Application web form we are using the
Microsoft.Office.Interop.Word COM DLL. We need to read some word documents
and create rtf files and merge them together into one doc file.
On click of a button the the word application com dll is getting activated,
but wehn we do this on a Windows Server 2003 machine we are getting the
following error.
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.
The COM DLL Microsoft.Word.Document has been given allow permission to the
ASPNET user account.
Can somebody help in setting the right permissions or finding a solution for
this.
This error in generated where the code has the following line
newApp = New Word.Application
Code:
Imports System.Runtime.InteropServices
Imports Word = Microsoft.Office.Interop.Word
Imports Office = Microsoft.Office.Core
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim newApp As Word.ApplicationClass
Dim source As Object = Server.MapPath("/site/Docs/" & sFileName)
Dim target As Object = Server.MapPath("/site/Docs/" & "temDocfile.rtf")
Dim unKnown As Object = Type.Missing
newApp = New Word.Application
newApp.Visible = True
newApp.Documents.Open(source, unKnown, unKnown, unKnown, unKnown,
unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown,
unKnown, unKnown)
Dim objformat As Object = Word.WdSaveFormat.wdFormatRTF
newApp.ActiveDocument.SaveAs(target, objformat, unKnown, unKnown,
unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown,
unKnown, unKnown, unKnown, unKnown)
newApp.ActiveDocument.Close(unKnown, unKnown, unKnown)
newApp.Quit(unKnown, unKnown, unKnown)
newApp = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComO bject(newApp)
newApp = Nothing
End Sub
This code provided is for a testing page we had created where we are trying
to open a word document file and save that as a rtf file.
The folder where these files are opened from and closed have full
permissions to the ASPNet user account.
Thanks in Advance
--
Warm Regards
Deepankar 1 4053
You are using Windows 2003? Try the NetworkService account instead of the
ASPNET account.
- Sahil Malik
You can reach me thru my blog at http://www.dotnetjunkies.com/weblog/sahilmalik
"Deepankar Raizada" <De**************@discussions.microsoft.com> wrote in
message news:55**********************************@microsof t.com... Hi
In one of our ASP.NET Application web form we are using the Microsoft.Office.Interop.Word COM DLL. We need to read some word documents and create rtf files and merge them together into one doc file.
On click of a button the the word application com dll is getting
activated, but wehn we do this on a Windows Server 2003 machine we are getting the following error.
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.
The COM DLL Microsoft.Word.Document has been given allow permission to the ASPNET user account.
Can somebody help in setting the right permissions or finding a solution
for this.
This error in generated where the code has the following line newApp = New Word.Application
Code: Imports System.Runtime.InteropServices Imports Word = Microsoft.Office.Interop.Word Imports Office = Microsoft.Office.Core
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim newApp As Word.ApplicationClass
Dim source As Object = Server.MapPath("/site/Docs/" & sFileName) Dim target As Object = Server.MapPath("/site/Docs/" & "temDocfile.rtf")
Dim unKnown As Object = Type.Missing
newApp = New Word.Application
newApp.Visible = True newApp.Documents.Open(source, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown)
Dim objformat As Object = Word.WdSaveFormat.wdFormatRTF
newApp.ActiveDocument.SaveAs(target, objformat, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown, unKnown)
newApp.ActiveDocument.Close(unKnown, unKnown, unKnown)
newApp.Quit(unKnown, unKnown, unKnown) newApp = Nothing System.Runtime.InteropServices.Marshal.ReleaseComO bject(newApp) newApp = Nothing
End Sub
This code provided is for a testing page we had created where we are
trying to open a word document file and save that as a rtf file.
The folder where these files are opened from and closed have full permissions to the ASPNet user account.
Thanks in Advance -- Warm Regards Deepankar This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: calfdog |
last post by:
Hello,
Does anyone know a workaround for calling fireEvent.
With the latest from Microsoft OS XP2 and Hot fixes to
IE it now gives an "access denied" error in Python when called.
Here is what...
|
by: Steve |
last post by:
Hi,
Yesterday I signed up for another dedicated linux server with the hosting
company I use and I am having problems getting MySQL 4.1.3 working on it.
I've tried just about everything I can...
|
by: |
last post by:
Hi All,
I have allready tried to ask a similar question , but got no answer until now. In the meantime, I
found, that I cannot understand some thread-settings for the Main() function
.
If I use...
|
by: ASP.Confused |
last post by:
The old message looked a little stale, so I am re-posting it here. Anybody
have any ideas of what I could do?!? The previous responses to this
question are below. If you want to look at the...
|
by: Brad |
last post by:
After compiling my asp.net project I'm receiving a "BC31011 - Access is
denied" error when attempting to run or debug. The only thing that seems to
resolve problem is IISReset. After a reset my...
|
by: Ron Weldy |
last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net
files. On my workstation I have a share set up to the folder where the web
files reside. I am just doing quick and dirty...
|
by: Shailesh Humbad |
last post by:
I figured out what was causing the "Access is Denied" error when
calling functions from referenced DLLs in my service. I've tried to
be very detailed, so bear with me.
It turns out that...
|
by: David Thielen |
last post by:
Hi;
I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But
when it tries to write a file I get:
Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images
...
|
by: Jeremy Ames |
last post by:
I am trying to move an application from my system to a new test system. I really should have tried an easier program first, but I didn't really have a chance. My application was originally written in...
|
by: Andy |
last post by:
Thanks Peter,
I thought I'd give an update on this problem. My application had 2
assemblies that contained classed for the Data access and business
logic layer. It was on one of them that I was...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |