Impersonating for [Local] File Access

D

David Williams

I have a DLL that I am writing that will be used from our web site. Within this DLL I must change the user that the code is running under so that I have access to several unmanaged API's, WMI, Registry read/write access, and creation and update of a number of files. The user that I am changing to is in a group (NOT an administator) that has the rights assigned in the group policy that I need. Changing to the user using the LoginUser API and setting the WindowsIndenity is fairly trival (once you know what needs to be done!).

The problem that I am currently struggling with is that a number of temporary files need to be created. When the call IO.Path.GetTempFileName is made an exception of "Invalid Directory Name" is thrown. I suppect that the problem is security related as when during debugging I attempt to see the Environment.SpecialFolders.ApplicationData directory it returns an empty string. Can anyone give me a pointer to what I need to do to continue forward?

TIA

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top