VintaSoft Twain .NET SDK v10.2
Credentials Property (HttpUpload)
Example 




Vintasoft.Twain.ImageUploading.Http Namespace > HttpUpload Class : Credentials Property
Provides authentication information for the request.
Syntax
'Declaration
 
Public Property Credentials As ICredentials
'Usage
 
Dim instance As HttpUpload
Dim value As ICredentials
 
instance.Credentials = value
 
value = instance.Credentials
public ICredentials Credentials {get; set;}
public: __property ICredentials* get_Credentials();
public: __property void set_Credentials( 
   ICredentials* value
);
public:
property ICredentials^ Credentials {
   ICredentials^ get();
   void set (    ICredentials^ value);
}
Remarks
The Credentials property contains authentication information to identify the maker of the request. The Credentials property can be either an instance of System.Net.NetworkCredential, in which case the user, password, and domain information contained in the NetworkCredential instance is used to authenticate the request, or it can be an instance of System.Net.CredentialCache, in which case the uniform resource identifier (URI) of the request is used to determine the user, password, and domain information to use to authenticate the request.
Example
The following example initializes a CredentialCache with multiple security credentials and uses those credentials with a HttpUpload:
Private Sub SetCredentials(ByVal httpUpload1 As HttpUpload, ByVal userName As String, _
                           ByVal securelyStoredPassword As String, ByVal domain As String)
    Dim myCache As CredentialCache = New CredentialCache()
    myCache.Add(New Uri("http://www.my-web-server.com/"), "Basic", _
                    New NetworkCredential(userName, securelyStoredPassword))
    myCache.Add(New Uri("http://www.my-web-server.com/"), "Digest", _
                New NetworkCredential(userName, securelyStoredPassword, domain))
    httpUpload1.Credentials = myCache
End Sub
public void SetCredentials(HttpUpload httpUpload, string userName,
    string securelyStoredPassword, string domain)
{
    CredentialCache myCache = new CredentialCache();
    myCache.Add(new Uri("http://www.my-web-server.com/"), "Basic",
                new NetworkCredential(userName, securelyStoredPassword));
    myCache.Add(new Uri("http://www.my-web-server.com/"), "Digest",
                new NetworkCredential(userName, securelyStoredPassword, domain));
    httpUpload.Credentials = myCache;
}
Requirements

Target Platforms: Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

See Also

Reference

HttpUpload Class
HttpUpload Members