When you want to create a folder on a network share on an other domain with the code Directory.CreateDirectory(@"\\nas\test")
, you can get a exception [Logon failure: unknown user name or bad password.]
Giving Full Control Permissions to the Everyone account does not solve the problem, because the application pool account is using a domain account [A] and the share
needs domain account [B] permissions

Create domain account [A] (eg. DOMAIN_A\User1 with password 12345A)
Create domain account [B] (eg. DOMAIN_B\User1 with password 12345A)
Make sure the application pool identity = DOMAIN_A\User1
Make sure the domain account DOMAIN_B\User1 has full control permissions on NetwerkShare "\\nas"
or use impersonation in C# code (domain account DOMAIN_B\User1 with password 12345A)

One Comment

  1. This doesn’t really explain why, computer A (win7), not on the same workgroup as computer B (win2k8), can create a directory on a share on computer B using Windows explorer, yet a c# program running on computer A using the same user credentials, cannot.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.