Reputation: 2783
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.
Upvotes: 0
Views: 289
Reputation: 7844
You don't need to use impersonation in order for ASP.NET to write files to the local server. You simply need to make sure that the identity that ASP.NET is using has permission to write to the location you're trying to write to.
Upvotes: 2