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

Posted on 2011-10-06
Last Modified: 2012-05-12
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,
Question by:Lighthouse325
    LVL 26

    Expert Comment

    by:Anurag Thakur
    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

    Author Comment

    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?

    LVL 26

    Accepted Solution

    impersonation is the best answer
    you dont need admin rights as i mentioned in my post above but by default the application runs under very limited access and with that access the user cannot create a file in the folder
    to solve this problem use impersonation and use the user for all the requests coming to the web server (this is the user under whose credentials the worker process is running and not the logged in user)

    Author Comment


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

    LVL 26

    Expert Comment

    by:Anurag Thakur
    what is the exception thats coming
    can ou please provide some details

    Author Comment

    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")


    Author Closing Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    In this article I will provide some simple productivity hacks that will help you use Google to specifically show results from any web site ( in my example), with minimal effort in Chrome and Firefox. I've seen a common theme a…
    A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
    The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
    XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

    737 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

    22 Experts available now in Live!

    Get 1:1 Help Now