Re: Access denied error while using excel object

S

Steve C. Orr, MCSD

In order to give ASP.NET the permissions it needs to use Excel, you'll likely need to add the line <identity impersonate="true"/> to your web.config file or configure your app to run under an appropriate user account.
 
Joined
May 27, 2009
Messages
1
Reaction score
0
Access denied error while using excel object

any body suggest me the solution for this

I am using excel object in my server side code. But, I am
getting Access denied error for the user asp.net . I gave
full permission for the Asp.net account on the directory
where I am running the application.Do I need to change any
security permission for excel?? Here is my code and the
exception that I am getting.

Excel.Application excel= new Excel.Application();
int rowIndex=1;
int colIndex=0;



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.
>


Source Error:


Line 1161: {
Line 1162:
Line 1163:Excel.Application excel= new Excel.Application();
Line 1164: int rowIndex=1;
Line 1165: int colIndex=0;


most intersting is that same code worked for 5-6 hours on the serve later error started

i did this also but colud not solve my problem still having that error
PLz help me

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top