The GetTempFileName() method uses the GetTempPath() function of the
kernel32.dll and there is a search order to get the path:
1.. The path specified by the TMP environment variable.
2.. The path specified by the TEMP environment variable.
3.. The path specified by the USERPROFILE environment variable.
4.. The Windows directory.
Gabriel Lozano-Morán
> I have a serviced component that is running in COM+ under a specific local
> user identity. Despite the fact that the process is running in the specified
> identity, Path.GetTempFileName SOMETIMES returns a filename located
> %windir%\temp.
Olivier Matrot - 28 Apr 2005 16:04 GMT
I already know that. My serviced component is loading the user profile
(successfully all times). To be more specific about "SOMETIMES" in my
previous post, it seems for me that the very first time the component is
loading by COM+ after a system restart, the behavior of GetTempFileName is
incorrect. If I shut down the COM+ running process, everithing is fine when
it is restarted upon request until the next system restart.
> The GetTempFileName() method uses the GetTempPath() function of the
> kernel32.dll and there is a search order to get the path:
[quoted text clipped - 10 lines]
>> identity, Path.GetTempFileName SOMETIMES returns a filename located
>> %windir%\temp.
Gabriel Lozano-Morán - 28 Apr 2005 17:09 GMT
You could log the DirectCaller together with the temporary path
Gabriel Lozano-Morán
Olivier Matrot - 16 Jun 2005 07:37 GMT
DirectCaller is "NT AUTHORITY\NETWORK SERVICE" which is correct, because my
service component is called from a web site.
CurrentIdentity is correct as well. This is the Identity specified in the
component services properties.
Thus, I do not understand why GetTempPath or GetTempFileName returns a wrong
path as described above.
> You could log the DirectCaller together with the temporary path
>
> Gabriel Lozano-Morán