How to get path of the current system's temporary folder using .NET (C#)
Temporary folders are useful to store simple logs during execution of the program. It is also used for storing the decompressed files before any operation. The folder location varies from OS to OS. The following C# snippet would help in retrieving the Temporary folder path
string sPath;
sPath = Path.GetTempPath();
Console.WriteLine("Temporary Path := " + sPath );
Temporary Folder using .NET (C#), C# Temporary Folder, C# Temp Folder, .NET Temporary Folder, .NET Temp Folder
Dim temp as String = System.IO.Path.GetTempPath
ReplyDeleteThats what im using, thanks btw!
Thats will resolve to the current USER temp folder if it exists. How can I retrieve the SYSTEM temp folder (ex: C:\Windows\Temp) from a program running in user land.
ReplyDeleteHi,
DeleteWhen you are using a different user (as impersonation) or using a system user you could use LogonUser and LoadUserProfile.
LogonUser changes the credentials, but, when you are trying GetTempPath you will receive the "old" temp path.
With the new user (the impersonated one) is it possible to not have access to the obtained path.
Kind regards,
Radu Cosoveanu
OK, do you not understand how this is useless if you don't show the class that it's in or what you're importing? Thanks for nothing.
ReplyDelete^ the anonymous above needs to learn how to use google and msdn
ReplyDelete^Also it is stated in the very first comment...
ReplyDeleteThanks shasur
try 'resolve'
ReplyDelete+2
ReplyDelete