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( string vcName, string proxy ) |
Visual Basic |
---|
Public Shared Sub SetDefaultCredentials ( _ vcName As String, _ proxy As String _ ) |
Visual C++ |
---|
public: static void SetDefaultCredentials( String^ vcName, String^ proxy ) |
Parameters
- vcName
- Type: String
VC name in "http://" or "vc://" format.
- proxy
- Type: String
The proxy server. Specify this if you explicitly need to connect using a proxy server. If no proxy should be used, then specify NoProxy. If the default proxy set in Internet Explorer needs to be used, specify null.
Examples
CopyC#
using System; using VcClient; using VcClientExceptions; namespace VcAgent { class Program { static void Main() { ///Use the logged in user account VC.SetDefaultCredentials("http://cosmos04.osdinfra.net/cosmos/MyVc", VC.NoProxy); try { ///Upload the local file to VC. The uploaded stream will expire in 10 days. VC.Upload(@"C:\inputs\sample.in", "/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()); } } } }