Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1219
  • Last Modified:

Access Denied problem

i have found this website that teaches hw to Automate Microsoft Excel from Visual Basic .NET

http://support.microsoft.com/default.aspx?scid=kb;en-us;301982

I cannot find Microsoft Excel Object Library in the COM tab instead the nearest i can get is Microsoft Excel 8.0 Object Library. After i v tried adding this Imports Microsoft.Office.Interop but gave error as there is no such namespace. I am using a web based application instead of windows application.

All these difference i think are no big deal but when i tried running the code, it gave access denied.
below is 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.

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

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 "{machinename}\ASPNET" user. Highlight the ASP.NET account, and check the Write box in the Allow column.

Source Error:

Line 31:             Dim oExcel As Excel.Application = New Excel.Application()

Can anyone tell me which file to give the access rights.

Thanks
0
adomsg
Asked:
adomsg
  • 2
  • 2
1 Solution
 
adomsgAuthor Commented:
i am actually using another code instead of the code listed in the page.
i use Dim oExcel As Excel.Application = New Excel.Application() instead of Dim oExcel As Excel.Application = CreateObject("Excel.Application") to create the excel. If i use the code listed on the page i get the error below:

Cannot create ActiveX component.
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.Exception: Cannot create ActiveX component.

Source Error:

Line 33:             Dim oExcel As Excel.Application = CreateObject("Excel.Application")
 
Thanks alot in advance.
0
 
testnCommented:
0
 
testnCommented:
0
 
adomsgAuthor Commented:
give me 1 to 2 days to try out, once done will give u the points. But from what i see, sound like it is difficult to implement the excel in server side. V u tried putting things into excel using VB.NET, can give some advice.

Thanks.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now