VPKSoft.UNCUtil

VPKSoft.UNCUtil

An (library) utility to access Windows (SMB/CIFS) shares with credentials.

Features

Requirements

  • A Microsoft® Windows® supporting .NET Framework v.4.5
  • LGPL v3 compatible application

Changes

 Usage

private void Test()
{
	try // an error might occur..
	{
		// IDisposable so using..
		using (UNCLogin share1 = new UNCLogin(@"\\server1\share1",
			new System.Net.NetworkCredential("username1", "password1", "domain1")))
		{
			// IDisposable so using..
			using (UNCLogin share2 =
				new UNCLogin(@"\\server2\share2", new System.Net.NetworkCredential("username2", "password2", "domain2")))
			{
				// a normal file operation with the given credentials.
				File.Copy(@"\\server1\share1\somefile.dat", @"\\server2\share2\somefile.dat");
			}
		}
	}
	catch (Exception ex)
	{
		// show the error message..
		MessageBox.Show(ex.Message);
	}
}

Download