Link to home
Start Free TrialLog in
Avatar of adomsg
adomsg

asked on

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
Avatar of adomsg
adomsg

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of testn
testn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adomsg

ASKER

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.