Solved

Access Denied problem

Posted on 2003-11-02
4
1,201 Views
Last Modified: 2013-11-25
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
Comment
Question by:adomsg
  • 2
  • 2
4 Comments
 
LVL 2

Author Comment

by:adomsg
ID: 9667985
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
 
LVL 18

Expert Comment

by:testn
ID: 9668620
0
 
LVL 18

Accepted Solution

by:
testn earned 50 total points
ID: 9668623
0
 
LVL 2

Author Comment

by:adomsg
ID: 9675624
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now