Link to home
Start Free TrialLog in
Avatar of Lighthouse325
Lighthouse325

asked on

Export data from ASP.Net to EXCEL 2010, do we need local administrator credential to run?

Hello experts!
My team has been developing an intranet application in ASP.Net, with Excel 2010 installed on the application server. Only local administrators can download the Excel file. Users, remote desktop users are asked to login. To automate that, we are considering iimpersonation in ASP.Net, but do we need local admin? And why?

Thank you,
KS
Avatar of Anurag Thakur
Anurag Thakur
Flag of India image

you don't need admin right to create a file - just a permission to save the file on the folder where it will be saved temporarily
Admin is a big permission and to save a file its just a folder access and that should solve your problem at hand
Avatar of Lighthouse325
Lighthouse325

ASKER

Thank you for reply raqi0017.
However, remote users can't run EXCEL on the application server.
The system only allows local admin for the access, but we don't want to give them the credential.
Possible solutions we found are;
1. Grant local admin "Network Service"
2. Impersonate as local admin.
My question is why do we need local admin to run EXCEL.
And is there better solution?

Thanks,
KS
ASKER CERTIFIED SOLUTION
Avatar of Anurag Thakur
Anurag Thakur
Flag of India image

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
raqi0017,

We are going for the impersonation.
We tested with EXCEL2010 and got errors where adding books.

Windows server 2003
Visual studio 2005
Language: VB.Net

Program code
---------------------------------------------------------------------------------------------------------------------------   Dim objExcel As New Excel.Application
   Dim objBooks As Excel.Workbooks = objExcel.Workbooks
   'Open new excel book
   Dim objBook As Excel.Workbook = objBooks.Add                <-- getting an error
   Dim objSheets As Excel.Worksheet = objBook.Sheets("Sheet1")
---------------------------------------------------------------------------------------------------------------------------
So far, to work around this error, impersonating accout needs to be an administrator.
Appreciate your help!!
KS


what is the exception thats coming
can ou please provide some details
Here is the exception;

Exception from HRESULT: 0x800A03EC
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.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC

Source Error:

Line 601:        'Dim objBooks As Excel.Workbooks = objExcel.Workbooks.Add(True)
Line 602:        'Open new excel book
Line 603:        Dim objBook As Excel.Workbook = objExcel.Workbooks.Add
Line 604:
Line 605:        Dim objSheets As Excel.Worksheet = objBook.Sheets("Sheet1")

Thanks,
KS
Thank you for the advicem, raqi0017. Although we could never configure without assign the impersonating account as local admin, it basically solve it.