String cannot be converted to Secure String

Hi community,

I’m trying to update the password using Set Credential Activity in UiPath Studio.
but I’m getting error as shown below.

image

image

Please help me with necessary modifications.

Thanks in Advance:-)

Hi @Vaishnav_Tej,

Can you share your activity’s screenshot please?

Kind Regards.

image

Hi @Vaishnav_Tej

Check out the video link

Regards
gokul

@Vaishnav_Tej
Another way is with the NetworkCredential type:

(new System.Net.NetworkCredential(“”, “myString”)).SecurePassword

image

And to convert from SecureString to String, you can use:

(new System.Net.NetworkCredential(“”, mySecureString,)).Password

change string to secure strung like this then pass to set credential

1 Like

Kindly use Get Credential activity after that get the password part.

Then use the pwd to Secure Password section in the set credential activity

Kind Regards.

@omer.ozturk He is not getting, he is setting already exist credentials Asset value

@raja.arslankhan, Thanks for the reminder, i got it wrong actually.

@omer.ozturk No problem dear, Happy Learning

Can you show how to pass in Set Credential Activity?

I think you misunderstand this activity.

Your screenshot shows you trying to assign the password at “123” and as “456”.
You can only use one of those properties. Either password (which accepts a string) or SecurePassword (which accepts a securestring).
Simple remove the string “456” and you can update the password to “123” as coded.

I dont think you are using SecureStrings here so perhaps you should ignore them entirely for now.

@Vaishnav_Tej
please check

Hi ,

I have updated as you said. Can you tell how to see the password which I updated ?

Because when I’ve used Message box to display Password , it is showing as below

image

I’m sorry but where you are updating the new password ?

@Vaishnav_Tej
I am updating my password in orchestrator credential

You set it to the value you put in the password property. If its the same as your original screenshot then “123”.

You cannot just display a securestring in a message box, its a secure string, its supposed to be secure therefore not easy to view the actual password.
I’m not sure why you need to do this also, you know what you changed it to, you just changed it…?

@Vaishnav_Tej

Why are you using System.Net.NetworkCredential?

If your pwd variable is a securestring already then its already the correct datatype. If your pwd variable is a string then its already not secure so you can just use the ‘Password’ property in ‘Set Credential’ instead of the ‘Secure Password’ property.
What you are doing doesn’t make sense in either scenario.