VintaSoft Twain .NET SDK 15.3: Руководство для .NET разработчика
Vintasoft.Twain.ImageUploading.Http Namespace / HttpUpload Class / Credentials Property
Синтаксис Ремарки Example Требования Смотрите также
В этом разделе
    Credentials Свойство (HttpUpload)
    В этом разделе
    Provides authentication information for the request.
    Синтаксис
    'Declaration
    
    Public Property Credentials As System.Net.ICredentials
    
    
    public System.Net.ICredentials Credentials { get; set; }
    
    
    public: __property System.Net.ICredentials* get_Credentials();
    public: __property void set_Credentials(
    System.Net.ICredentials* value
    );
    Ремарки

    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;
    }
    
    

    Требования

    Целевые платформы: .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также