I have two computers running Windows Server 2003. One computer has shared folders on the network, and the other has a Windows service (written in C # running under the Network Service account) that must access these shared folders.
The following code works fine as the user who logged in, but throws an exception when executed in the Network Service account.
File.WriteAllText(@"C:\temp\temp.txt", File.ReadAllLines(@"\\NetworkServer\Test\test.txt")[0]);
Logon failure: unknown user name or bad password exception message. How to make this code work under the Network Service account? Is this a setting in Windows Server 2003 or do I need to add code for this to work?
source share