How do I get impersonation to work?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is my scenario. I have an ASP.net page that exports a Crystal Report file. When I export the file, the app uses the ASPNET user, which doesn't have the appropriate rights to the network drive that I'm saving the report to.

I thought by adding the <identity impersonate="true" userName="user" password="password"/> to my web.config file would do the trick (obviously giving it a valid user and password). But when I run filemon to look at the access denied error, it shows the user as ASPNET.

I have also tried the following (to no avail):

currentWindowsIdentity = CTypeUser.Identity,System.Security.Principal.WindowsIdentity)
impersonationcontext = currentWindowsIdentity.Impersonate()

<code to be run under the impersonation....>

impersonationcontext.Undo()

Am I leaving something out, not doing it right at all ???? I have not tried the LogonUser scenario, as I thought I had this working with just the web.config yesterday, but today, no go...

Any help would be greatly appreciated.

Ed
 
Back
Top