# How to convert string to secure string

**URL:** <https://forum.uipath.com/t/how-to-convert-string-to-secure-string/700894>\
**Category:** Studio\
**Tags:** system\
**Created:** [November 20, 2023, 4:28am UTC](https://forum.uipath.com/t/how-to-convert-string-to-secure-string/700894 "2023-11-20T04:28:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent2](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vincent2/32/408385_2.png) [@Vincent2](https://forum.uipath.com/u/Vincent2)\
**Post date:** [November 20, 2023, 4:28am UTC](https://forum.uipath.com/t/how-to-convert-string-to-secure-string/700894/1 "2023-11-20T04:28:36Z")

</div>

Hi Everyone,

I have a requirement to pass a secure string and I would like to convert a string to achieve that.

Any functions available to achieve

---

<div class="post-metadata">

**Author:** ![nikhil.girish](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nikhil.girish/32/462341_2.png) [@nikhil.girish](https://forum.uipath.com/u/nikhil.girish)\
**Post date:** [November 20, 2023, 4:29am UTC](https://forum.uipath.com/t/how-to-convert-string-to-secure-string/700894/2 "2023-11-20T04:29:11Z")

</div>

Hi @Vincent2

If you need convert ‘String’ to ‘System.Security.SecureString’  
You can use assign:

YourString = new System.Net.NetworkCredential(string.Empty, YourSecurityString).Password

Hope this helps

---

<div class="post-metadata">

**Author:** ![Parvathy](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/parvathy/32/484539_2.png) [@Parvathy](https://forum.uipath.com/u/Parvathy)\
**Post date:** [November 20, 2023, 4:31am UTC](https://forum.uipath.com/t/how-to-convert-string-to-secure-string/700894/3 "2023-11-20T04:31:16Z")

</div>

Hi @Vincent2

Try this:

```auto
(New System.Net.NetworkCredential("","give the password 
here")).SecurePassword

```

Output DataType System.Security.SecureString

Hope it helps!!

---

<div class="post-metadata">

**Author:** ![Nguyen\_Van\_Luong1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nguyen_van_luong1/32/442389_2.png) [@Nguyen\_Van\_Luong1](https://forum.uipath.com/u/Nguyen_Van_Luong1)\
**Post date:** [November 20, 2023, 4:35am UTC](https://forum.uipath.com/t/how-to-convert-string-to-secure-string/700894/4 "2023-11-20T04:35:46Z")

</div>

Hi @Vincent2 ,  
You can use  
new System.Net.NetworkCredential(string.Empty, yourPassword).Password  
eg:

 ![image](https://global.discourse-cdn.com/uipath/original/4X/9/6/0/9607932e5724b75179ecb2868984081a49c6d873.png)  
get  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/6/7/9/679e5a707ac1940a6337fbfe451ff7e40d9b5f04.png)

regards.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [November 23, 2023, 4:36am UTC](https://forum.uipath.com/t/how-to-convert-string-to-secure-string/700894/5 "2023-11-23T04:36:30Z")

</div>

Closed on November 23, 2023, 4:36am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
