Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

OPC UA - User Name with backslash (\)

More
16 Mar 2021 12:25 #9509 by Rperez
Hello,

Thank you for your support. I works directly with: Dim endpoint As UAEndpointDescriptor = New UAEndpointDescriptor(OPCServer).WithUserNameIdentity(UserName, Password)

Please Log in or Create an account to join the conversation.

More
16 Mar 2021 10:15 #9507 by support
Hello,

one such example is here: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...nregister%20all%20clients.html

And you can put a backslash into the user name and will stay there. Just do not try to get it back from UAEndpointDescriptor.UserName, because that is a different thing.

If you really want to check that the the backslash "stays" there, you need to check UAEndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName.

Best regards

Please Log in or Create an account to join the conversation.

More
16 Mar 2021 10:10 #9506 by support
These lines should be removed (they are not doing any harm, but they terribly confuse you, because you then tend to inspect the result and complain about the removed backslash):
endpoint.UserName = UserName
endpoint.Password = Password
Best regards

Please Log in or Create an account to join the conversation.

More
16 Mar 2021 08:19 #9505 by Rperez
Can you send me an example with he best way to identify?

Best Regards

Please Log in or Create an account to join the conversation.

More
16 Mar 2021 08:14 #9504 by Rperez
Hello,

I am sorry but I don't follow you. I attach all my code:

Dim UserName As String = "user1"
Dim Password As String = "pass1"

If EasyUAClient Is Nothing Then InitUA()

Dim HandleID As Integer = 0
Dim item As OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments
Value = Nothing

If (String.IsNullOrEmpty(UserName)) Then
item = New OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments(OPCServer & OPCTag, OPCServer, OPCTag, New UAMonitoringParameters(Optional_OPCRequestedUpdateRate))
Else
Dim endpoint As UAEndpointDescriptor = New UAEndpointDescriptor(OPCServer).WithUserNameIdentity(UserName, Password)
endpoint.UserName = UserName
endpoint.Password = Password

item = New OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments(OPCServer & OPCTag, OPCServer, OPCTag, New UAMonitoringParameters(Optional_OPCRequestedUpdateRate))
item.EndpointDescriptor = endpoint
End If
HandleID = EasyUAClient.SubscribeMonitoredItem(item)
Return HandleID

They line in bold should be changed you mean?

Thank you in advance.

Please Log in or Create an account to join the conversation.

More
15 Mar 2021 18:20 #9503 by support
What you wrote makes no sense. You "cannot get the same result" if you use just WithUserNameIdentity, because your code is then printing out UAEndpointDescriptor.UserName and UAEndpointDescriptor.Password, which, I repeat, should not be used.

Please Log in or Create an account to join the conversation.

More
15 Mar 2021 17:27 #9500 by Rperez
Hello,

The code is done by vb.net.

If I use the following expresion:

UAEndpointDescriptorExtension.WithUserNameIdentity(New OpcLabs.EasyOpc.UA.UAEndpointDescriptor(OPCServer), UserName, Password)

I receive the same result.

Which function should I use in orden to identify?

The code work properly if there is not a backslash in the UserName.

Best Regards,

Please Log in or Create an account to join the conversation.

More
15 Mar 2021 17:05 #9498 by support
Replied by support on topic User Name
I am confused. First question, which language or tool is this code in?

More:

You seem to be mixing two things, although the code seem to be incomplete. The WithUserNameIdentity extension method would be the right approach.
Setting UserName and Password directly on UAEndpointDescriptor is *not* the right approach, so trying to resolve why it behaves the way it behaves with the backslash is pointless. So you can just leave out these parts.

Best regards

Please Log in or Create an account to join the conversation.

More
15 Mar 2021 16:53 #9496 by Rperez
Replied by Rperez on topic User Name
Hello,

We use the following code:

Dim uAEndpointDescriptor As OpcLabs.EasyOpc.UA.UAEndpointDescriptor = UAEndpointDescriptorExtension.WithUserNameIdentity(New OpcLabs.EasyOpc.UA.UAEndpointDescriptor(OPCServer), UserName, Password)
uAEndpointDescriptor.set_UserName(UserName)
uAEndpointDescriptor.set_Password(Password)
LogTXT(String.Format("+++++++++ endpoint.UserName: {0} - endpoint.Password: {1} - endpoint.Port: {2}", uAEndpointDescriptor.get_UserName(), uAEndpointDescriptor.get_Password(), uAEndpointDescriptor.get_Port()), False, "")


IF We use the following user and password

USER: name\user
Password: 1234

We get the following data:
+++++++++ endpoint.UserName: - endpoint.Password: 1234 - endpoint.Port: -1

IF We use the following user and password

USER: nameanduser
Password: 1234

We get the following data:
+++++++++ endpoint.UserName: nameanduser - endpoint.Password: 1234 - endpoint.Port: 65300

Please Log in or Create an account to join the conversation.

More
15 Mar 2021 16:20 #9495 by support
Replied by support on topic User Name
Hello,
please post a code example, and explain where do you get "null".

Best regards

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.061 seconds