Impersonation and environment variables

IfYouSaySo

Well-known member
Joined
Jan 4, 2006
Messages
102
Location
Hermosa Beach, CA
Programming Experience
3-5
Ok, so I'm running into a problem where I impersonate another user (using unmanaged call to LogonUser, followed by WindowsIdentity.Impersonate(), etc.), and the impersonation goes OK, but I'm finding that key environment variables are still what they were before the impersonation. I.e. TMP points to C:\Documents and settings\old user\local settings\temp\. Maybe that's normal, but I was kind of hoping that it wasn't, because then calls like Path.GetTempFileName() start failing.

I guess I can fix up the TMP environment variable to get the behavior I want, but that really seems like a lame hack. Isn't there some other way around all this? Maybe I'm not doing something quite right?

Thanks for any info...
 
Back
Top