I get "Access denied" when using Dim wordApp As New Microsoft.Office.Interop.Word.App

Alex_bg

Newcomer
Joined
Dec 26, 2004
Messages
17
I get "Access denied" when using Dim wordApp As New Microsoft.Office.Interop.Word.App

Hello,

I am using VS 2003, ASP.NET and VB.
I get a server error "Access denied" when I try to execute the following code:

Dim wordApp As New Microsoft.Office.Interop.Word.Application

the error has the following text:

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.

Source Error:


Line 265:
Line 266: Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
Line 267: Dim wordApp As New Microsoft.Office.Interop.Word.Application
Line 268: Dim wdDoc As New Microsoft.Office.Interop.Word.Document
Line 269: Dim txtRange As Microsoft.Office.Interop.Word.Range


Source File: C:\Inetpub\wwwroot\paperless SMD\main page.aspx.vb Line: 267

Stack Trace:


[UnauthorizedAccessException: Access is denied.]
paperless_SMD.WebForm1.Button26_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\paperless SMD\main page.aspx.vb:267
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1273


Thanks,
Aleks
 
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.

Seems pretty straightforward to me. Have you tried it?
 
Back
Top