Quantcast
Channel: OPC Labs - OPC Labs - Recent Topics - OPC Labs Online Forums
Viewing all articles
Browse latest Browse all 1794

"BadCertificateUntrusted" exception when programmatically reading value with identifier - by: Restrepo

$
0
0
Hello Z,

I been testing a sample application where I can read a Value from a OPC UA server(In this case is TOP Server) with an specific user name credentials, but it seems that when I try to read the UA node value with the code below I get a "BadCertificateUntrusted" exception. I got this to work with Quick OPC 2018.1 version without any issues; however, I keep getting the error on the newest version of Quick OPC. I did notice that when I try to connect to the same endpoint using connectivity explorer with the identity property configured with the user name and password, I get a prompt to trust a certificate. I believe this is the same issue; however, how would i go of handling this on my code? please see attached screen shot for the prompt. Thanks in advance.

code:

string userName = "User1";
string passWord = "Pass1";
string UAUrl = "opc.tcp://127.0.0.1:49380";
string NodeDescriptor = "nsu=TOP Server;ns=2;s=Channel1.Device1.Tag1";

private void button1_Click(object sender, EventArgs e)
{

var UAEndPoint = new UAEndpointDescriptor
{
UrlString = UAUrl
};
UAEndPoint.UserIdentity.UserNameTokenInfo.UserName = userName;
UAEndPoint.UserIdentity.UserNameTokenInfo.Password = passWord;

var ReadValue = easyUAClient1.ReadValue(UAEndPoint, NodeDescriptor).ToString();

label1.Text = String.Format("Tag1 Value : [ {0} ]", ReadValue);

}

Viewing all articles
Browse latest Browse all 1794

Trending Articles