示例#1
0
        public string ConnectorNetworkPath(string drive, string localDrive, string userName, string password)
        {
            NetworkDrive oNetDrive = new NetworkDrive();

            try
            {
                oNetDrive.LocalDrive = localDrive;
                oNetDrive.ShareName  = drive;



                if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password))
                {
                    oNetDrive.MapDrive(userName, password);
                }
                else
                {
                    oNetDrive.MapDrive();
                }

                drive = localDrive;
            }
            catch
            {
                //if (_logger != null)
                //{
                //  _logger.AuditError("Error mapping drive", err);
                //}
            }
            oNetDrive = null;
            return(drive);
        }
示例#2
0
        public void DisconnectNetworkPath(string drive)
        {
            NetworkDrive oNetDrive = new NetworkDrive();

            try
            {
                oNetDrive.LocalDrive = drive;
                oNetDrive.UnMapDrive();
            }
            catch
            {
                //if (_logger != null)
                //{
                //  _logger.AuditError("Error unmapping drive", err);
                //}
            }
            oNetDrive = null;
        }