This method is similar to VC.Setup and allows you to use the logged in machine credentials for
communicating with Cosmos. Using default credentials gives the advantage of not having to encode the user credentials.
Namespace: VcClientAssembly: VcClient (in VcClient.dll) Version: 1.0.0.0 (1.8.400.4142)
Syntax
C# |
---|
public static void SetDefaultCredentials() |
Visual Basic |
---|
Public Shared Sub SetDefaultCredentials |
Visual C++ |
---|
public: static void SetDefaultCredentials() |
Examples
CopyC#
using System; using VcClient; using VcClientExceptions; namespace VcAgent { class Program { static void Main() { ///Use the logged in user account VC.SetDefaultCredentials(); try { ///Upload the local file to VC. The uploaded stream will expire in 10 days. VC.Upload(@"C:\inputs\sample.in", "http://cosmos04.osdinfra.net/cosmos/MyVc/my/sample.in", false, TimeSpan.FromDays(10)); } catch (StreamAlreadyExistsException streamAlreadyExistsException) { Console.WriteLine("The stream already exists."); Console.WriteLine(streamAlreadyExistsException.ToString()); } catch (FileUploadException fileUploadException) { Console.WriteLine("Error uploading file"); Console.WriteLine(fileUploadException.ToString()); } catch (VcClientException vcClientException) { Console.WriteLine(vcClientException.ToString()); } } } }