[C# ASP.NET] "Access is denied" error

Pagina: 1
Acties:

  • vdroos
  • Registratie: Februari 2004
  • Laatst online: 09-04 08:24
Ik ben aan het proberen om deze HOW TO werkend te krijgen:

HOW TO: Automate Word from Visual C# .NET to Create a New Document

The sample code in this article demonstrates how to do the following: • Insert paragraphs with text and formatting.
• Browse and modify various ranges within a document.
• Insert tables, format tables, and populate the tables with data.
• Add a chart.

Maar ik krijg de volgende foutmelding:
Server Error in '/CreateWord' Application.
--------------------------------------------------------------------------------

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 58: Word._Application oWord;
Line 59: Word._Document oDoc;
Line 60: oWord = new Word.Application();
Line 61: oWord.Visible = true;
Line 62: oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,


Source File: c:\inetpub\wwwroot\createword\webform1.aspx.cs Line: 60
De oplossing lag voor mij voor de hand, namelijk het toevoegen van de rechten aan de desbetreffende map in explorer en IIS5:
- ASP.NET Machine Account
- Internet Guest Account
- Launch IIS Process Account

Maar dit helpt niet. Iemand een idee?????

VDROOS


  • vdroos
  • Registratie: Februari 2004
  • Laatst online: 09-04 08:24
Niemand? :?

VDROOS


  • Glorix Jim
  • Registratie: Februari 2000
  • Laatst online: 11-05 14:23
Heeft het toevallig niet te maken met de application pool?
Misschien dat ie geen voldoende rechten heeft om te kunnen schrijven?

  • vdroos
  • Registratie: Februari 2004
  • Laatst online: 09-04 08:24
Glorix Jim schreef op donderdag 16 december 2004 @ 10:11:
Heeft het toevallig niet te maken met de application pool?
Misschien dat ie geen voldoende rechten heeft om te kunnen schrijven?
Bedoel je de Application Protection?? (ik draai IIS5 op win200 pro)
Die staat nu op medium (pooled).
Wat zou ik moeten veranderen om hem wel voldoende schrijfrechten te gegeven?

[ Voor 4% gewijzigd door vdroos op 16-12-2004 13:00 ]

VDROOS


  • Glorix Jim
  • Registratie: Februari 2000
  • Laatst online: 11-05 14:23
vdroos schreef op donderdag 16 december 2004 @ 12:58:
[...]


Bedoel je de Application Protection?? (ik draai IIS5 op win200 pro)
Die staat nu op medium (pooled).
Wat zou ik moeten veranderen om hem wel voldoende schrijfrechten te gegeven?
Nee sorry de application pool is het niet (ik zit nu zelf telkens met Sharepoint te klooien en daar hangt alles af van de application pool die je gebruikt).
Wat voor rechten heb je op IIS? Windows integrated? Of anonymous?
Als je Windows Integrated gebruikt, dan moet de gebruiker die dan de applicatie gebruikt ook rechten hebben op desbetreffende dir

Verwijderd

Ik zou het zoeken in het niet mogen creeeren van een word object. Als je de code checked zie je dat ernog niet eens iets gedaan wordt met een bestand/map, maar alleen een "new ....();"

ik zou daar ff op gaan googlen

Verwijderd

Volgens mijn mag je
C#:
1
Line 61: oWord.Visible = true;

niet gebruiken in een web-app. De webserver heeft toch geen GUI om Word op zichtbaar te maken?
Pagina: 1