Convertfrom-securestring value empty

hi

im able to set username and password as cookies,

the password is set as a secure string

when i try to convert the password from a secure string the value seems to be empty

ive tried 2 ways to convert from secure string below and the value is always blank in my dashboard

the 2nd method below gives me the expected value in ISE but not in ud

running enterprise 2.9 on IIS

any ideas what im doing wrong or how i can use the value of converted from a secure string in my dashboard

code snippet below thanks

#grab user and password value from input elements and set values as cookies

$session:user = (Get-UDElement -Id userinput).attributes[“value”]

$session:password = (Get-UDElement -Id passwordinput).attributes[“value”]

$session:securepassword = ConvertTo-SecureString -AsPlainText $session:password -Force

$Response.Cookies.Append(“User”, $session:user)

$Response.Cookies.Append(“Password”, $session:securepassword)

#Convert from secure string method 1
$session:convertedpassword1 = ConvertFrom-SecureString -SecureString $session:securepassword

#this method doesnt output anything if i toast $session:convertedpassword1 from the dashboard but gives me a bunch of #s when i write-host in ISE

#Convert from secure string method 2
$session:convertedpassword2 = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR( $session:securepassword ))

#this method doesnt output anything if i toast $session:convertedpassword2 from the dashboard but gives me but gives me the expected password value when i write-host in ISE

Did you ever figure this out?

Never got this working

Some browsers are moving away from cookies as well so may want to find a different way to accomplish what you need

There’s some less secure ways to grab the password values though ie storing the value in an input element that’s hidden (,or not,) on your dashboard or maybe using a modal to prompt for the password when needed