My understanding was that if asp.net application wants to write file to file server, it needs to use impersonation. I use the support.microsoft.com/kb/306158#4 "Impersonate a Specific User in Code" to do it. But it didn't work. The GetLastError() was giving error code 1326 "Logon failure: unknown user name or bad password." ( as per msdn.microsoft.com/en-us/library/ms681385) Then, the only way it worked was I've to create user (My computer > manage > local user and groups > user) with same user name and password as the file server folder. Now, even if I removed the impersonation code, it still works. So, I'm confused. Why do we need impersonation? I'm using XP and windows 2008 server.