Author: oaktree_la | Posted on: 12/24/2009 3:07:52 PM | Views : 682

Hi,
I have an web application that I need to create Excel files on the server on the fly. For security reasons, I want to use the impersonation technique, such as the following:
IntPtr token = new IntPtr(); bool result = LogonUser(_username, _domain, _password, logonType, logonProvider, ref token); using (WindowsIdentity.Impersonate(token)) { ImpersonateLoggedOnUser(token); ////////////Code to create Excel files (see below)/////////// RevertToSelf(); CloseHandle(token); } Then I create the Excel file by treating Excel as an OLE db, such as follows: string strConnectionToExcel = @&quo ...

Go to the complete details ...