As I understand it, you're supposed to use the Environment.GetFolderPath method so you have OS independent code...
Windows XP uses C:\Documents and Settings\. Windows Vista uses C:\ProgramData and C:\Users.
I'm using the code below on a Windows Vista computer and it's returning a C:\Documents and Settings\ directory instead of C:\ProgramData like it should... Any ideas?
string commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
try
{
File.CreateText(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
"\\mycompany\\uid");
log.Debug("Created file successfully");
}
catch (Exception ex)
{
log.Error("Unable to create the uid file: ", ex);
}