Exemplo n.º 1
0
        public static FileShareAuthenticationContext BeginFileShareAuthentication(string remoteUnc, string userName, string password)
        {
            string error = PinvokeWindowsNetworking.connectToRemote(remoteUnc, userName, password);

            if (!string.IsNullOrEmpty(error))
            {
                throw new Exception("Error calling PinvokeWindowsNetworking.connectToRemote: " + error);
            }
            return(new FileShareAuthenticationContext(remoteUnc, userName, password));
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (_active)
     {
         var error = PinvokeWindowsNetworking.disconnectRemote(_remoteUnc);
         if (!string.IsNullOrEmpty(error))
         {
             throw new Exception("PinvokeWindowsNetworking.disconnectRemote failed: " + error);
         }
         _active = false;
     }
 }