HOW TO AUTHORIZE ASP.NET TO MAKE USE OF Excel dll?

liunx

Guest
hai every one,

HOW TO AUTHORIZE ASP.NET TO MAKE USE OF Excel dll?????????????

i am trying to work with Excel from ASP.net( C #) i know i need to set reference

of Microsoft Office 10.0 and Microsoft Excel 10.0 in my project but when iam

trying to create an object of Excel following error occurs.....

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.

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 24: Excel.ApplicationClass objExcel=null;
Line 25: objExcel=new Excel.ApplicationClass();

===============================================================================

what am i missing please help........?


tanks to showing patience to read this mail......
and thanks in advance ....for the help

keep smiling....

austin neelankavilNot really sure, but you might want to make sure that the asp.net account has access to the folder that the dll is in. and that it has right to that dll.


EricHi,

U need to impersonate the aspnet account when trying to access office applications which requires administrator privileges. By default the asp.net application runs with the privileges of the account : machinename\aspnet

and, this account does not have administrator privileges by default.

u can do 3 things to use an administrator account for your asp.net applications:

1. Add the machinename\aspnet account to the Administrators group by using the computer management console.

2. Use an account which has administrator privileges on the web server machine: to do this, open ur web.config file, just below the authentication tag write this line:
<identity impersonate="true" userName="machinename\administrator" password="admin password" />

this is called impesonating asp.net to use a fixed account.

3. Open ur web.config file, just below the authentication tag write this line:
<identity impersonate="true" />
and, logon with an administrator account on this machine before running the asp.net application. This method is called impersonating asp.net to use the logged on account.

please let me know if any problem is still there.

ThanksHi,

U need to impersonate the aspnet account when trying to access office applications which requires administrator privileges. By default the asp.net application runs with the privileges of the account : machinename\aspnet

and, this account does not have administrator privileges by default.

u can do 3 things to use an administrator account for your asp.net applications:

1. Add the machinename\aspnet account to the Administrators group by using the computer management console.

2. Use an account which has administrator privileges on the web server machine: to do this, open ur web.config file, just below the authentication tag write this line:
<identity impersonate="true" userName="machinename\administrator" password="admin password" />

this is called impesonating asp.net to use a fixed account.

3. Open ur web.config file, just below the authentication tag write this line:
<identity impersonate="true" />
and, logon with an administrator account on this machine before running the asp.net application. This method is called impersonating asp.net to use the logged on account.

please let me know if any problem is still there.

Thanks


sharma_vijaysai:
Hi,
As you said,this can really work on local machine but it still can not access on the client machine.
Here is my problem, I am trying to make the clients to print the dataset run at server.
At server, first i export the data in dataset as xml file,
second import the xml file into an new excel application
then try to print the excel.

when I debug on the local machine(server) it goes well throught the ways as you said, but still can not be accessed from the client. How to solve this?

By the way, could the clients still print with no excel installed if just click the button then print,no need to open the Excel or Preview before print
 
Back
Top