When you run the code in Visual Studio it runs under the the rights of your user.
When you run the code in IIS it runs in the identity of the Application Pool which by default is the built in user "
Network Service
" this is a local user account which does not have access outside the local machine. The rights on the network share are the first layer, after that the NTFS rights on the directory are checked. You need to change the identity of the application pool to a domain user with the same rights as your user.
[
Actual answer Reference[
^]]
--Amit