OPC Studio User's Guide and Reference
HttpsCertificateAcceptancePolicy Property (_UASmartClientEngineParameters)
Example 



View with Navigation Tools
OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.Engine.ComTypes Namespace > _UASmartClientEngineParameters Interface : HttpsCertificateAcceptancePolicy Property
Determines which HTTPS server certificates are accepted.
Syntax
'Declaration
 
<CanBeNullAttribute()>
Property HttpsCertificateAcceptancePolicy As UACertificateAcceptancePolicy
 
'Usage
 
Dim instance As _UASmartClientEngineParameters
Dim value As UACertificateAcceptancePolicy
 
instance.HttpsCertificateAcceptancePolicy = value
 
value = instance.HttpsCertificateAcceptancePolicy

Property Value

This value of this property can be null (Nothing in Visual Basic).

The default value of this property is null.

Remarks

When this is null, the policy given by OpcLabs.BaseLib.Security.CertificateAcceptancePolicy is used. This causes the same rules be used for HTTPS server certificates as for server instance certificates.

In order to obtain or modify this parameter, access the OpcLabs.EasyOpc.UA.Engine.EasyUAClientSharedParameters.EngineParameters property of static OpcLabs.EasyOpc.UA.EasyUAClientCore.SharedParameters.

This member or type is for use from COM. It is not meant to be used from .NET or Python. Refer to the corresponding .NET member or type instead, if you are developing in .NET or Python.

This method or property does not throw any exceptions, aside from execution exceptions such as System.Threading.ThreadAbortException or System.OutOfMemoryException.

Example
// This example shows how in a console application, the user is asked to accept a server HTTPS certificate.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

using System;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.OperationModel;

namespace UADocExamples.Interaction
{
    partial class AcceptCertificate
    {
        public static void Https()
        {
            // Do not implicitly trust any endpoint URLs. We want the user be asked explicitly.
            EasyUAClient.SharedParameters.EngineParameters.CertificateAcceptancePolicy.TrustedEndpointUrlStrings.Clear();

            // Define which server we will work with.
            UAEndpointDescriptor endpointDescriptor = "https://opcua.demo-this.com:51212/UA/SampleServer/";
            
            // Instantiate the client object.
            var client = new EasyUAClient();

            UAAttributeData attributeData;
            try
            {
                // Obtain attribute data.
                // The component automatically triggers the necessary user interaction during the first operation.
                attributeData = client.Read(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853");
            }
            catch (UAException uaException)
            {
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException().Message);
                return;
            }

            // Display results.
            Console.WriteLine("Value: {0}", attributeData.Value);
            Console.WriteLine("ServerTimestamp: {0}", attributeData.ServerTimestamp);
            Console.WriteLine("SourceTimestamp: {0}", attributeData.SourceTimestamp);
            Console.WriteLine("StatusCode: {0}", attributeData.StatusCode);
        }
    }
}
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also