Groups | Blog | Home
all groups > dotnet component services > april 2005 >

dotnet component services : Problem with Path.GetTempFileName



Olivier Matrot
4/27/2005 12:00:00 AM
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.

LOZANO-MORÁN, Gabriel
4/27/2005 12:00:00 AM
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

[quoted text, click to view]

Olivier Matrot
4/28/2005 12:00:00 AM
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.

[quoted text, click to view]

Gabriel Lozano-Morán
4/28/2005 12:00:00 AM
You could log the DirectCaller together with the temporary path

Gabriel Lozano-Morán

Olivier Matrot
6/16/2005 8:37:48 AM
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.

[quoted text, click to view]

AddThis Social Bookmark Button