default directory c:\winnt\system32?

  • Thread starter Thread starter HVE
  • Start date Start date
H

HVE

Hello,

I have a very simple C# WindowsForms app accessing a file. Framework 1.0
SP2. The filename is used without any path reference. On 99% of machines I
tested, the file is correctly located in the applications startup
directory.

On one machine however, it looks for the file in c:\winnt\system32.
I can of course reference the path by using Application.StartupPath, but I
would like to know what is causing this, since the one machine is a
production server...

Any clues?

Hans
 
What is probably happening (I had a similar problem recently) is that the
"current directory" is changed by something you are doing to
C:\winnt\system32. To pinpoint where this happens you can use
Directory.GetCurrentDirectory().

-Vance
 
What is probably happening (I had a similar problem recently) is that the
"current directory" is changed by something you are doing to
C:\winnt\system32. To pinpoint where this happens you can use
Directory.GetCurrentDirectory().

-Vance
I checked Directory.GetCurrentDirectory after every line of code and it
always showed me the correct application path. Yet the application keeps
looking for my file in c:\winnt\system32. Very strange behaviour.

Hans
 
Hans,
I'd check the PATH setting of the machine in question to see if
something is set differently.

Ron Allen
 
Hans,
I'd check the PATH setting of the machine in question to see if
something is set differently.

Ron Allen

Ron,

the path contains nothing extraordinary.

Meanwhile I have found a couple of other strange issues on that server
though. I ran Filemon from Sysinternals and found that my app calls the COM
services dll of Windows 2000, the Microsoft database support DLL for
Oracle,... It also doesn't access the security config files.

Enough to seriously consider removing and reinstalling the .NET Framework
over the weekend.

thanks

Hans
 
Back
Top