Currently, I use Path.GetTempPath()
to figure out where to write my log files, but recently I came across a user's machine where the path returned was not what I expected.
Usually, the returned path is C:Documents and Settings[userid]Local SettingsTemp
but in this case, it was C:Temp
This would not normally be a problem, but for some reason the user in question did not have access to write to C:Temp
I double checked the environment variables, and the USER environment variable was pointing as expected to C:Documents and Settings[userid]Local SettingsTemp, whilst the SYSTEM environment variable was pointing to C:WINNTTemp.
So... where is Path.GetTempPath()
getting it's value from ? Group Policy? Registry?
I have Googled, but to no avail.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…