Credentials Property (HttpUpload)
Provides authentication information for the request.
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.
The following example initializes a CredentialCache with multiple security credentials and uses those credentials with a HttpUpload:
Public Sub SetCredentials(httpUpload As Vintasoft.Twain.ImageUploading.Http.HttpUpload, userName As String, securelyStoredPassword As String, domain As String)
Dim myCache As New System.Net.CredentialCache()
myCache.Add(New System.Uri("http://www.my-web-server.com/"), "Basic", New System.Net.NetworkCredential(userName, securelyStoredPassword))
myCache.Add(New System.Uri("http://www.my-web-server.com/"), "Digest", New System.Net.NetworkCredential(userName, securelyStoredPassword, domain))
httpUpload.Credentials = myCache
End Sub
public void SetCredentials(Vintasoft.Twain.ImageUploading.Http.HttpUpload httpUpload, string userName, string securelyStoredPassword, string domain)
{
System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new System.Uri("http://www.my-web-server.com/"), "Basic",
new System.Net.NetworkCredential(userName, securelyStoredPassword));
myCache.Add(new System.Uri("http://www.my-web-server.com/"), "Digest",
new System.Net.NetworkCredential(userName, securelyStoredPassword, domain));
httpUpload.Credentials = myCache;
}
Target Platforms: .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5