Question
Paul Riker · Jun 29, 2016

CSP Illegal Value error

I've created a CSP page to take in a base64 value from a <textarea> and decode it. When I run it I get the error . Any ideas?

Error: <ILLEGAL VALUE>zOnPageBODY+28^csp.decode.1

ErrorNo: 5002

Here is my code

<form method="post" action="">
<table>
<tr><td><textarea rows="40" cols="200" name="submitstring"></textarea></td></tr>
<tr><td><select name="decodeoption"><option>Decode</option><option>Encode</option></select><input type="submit"/></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><h2>Result</h2></td></tr>
<tr><td>

<script language=Cache runat=server>
Set tString = $Get(%request.Data("submitstring",1))
Set tAction = $Get(%request.Data("decodeoption",1))
If tAction = "Decode"
{
Set tOutput = $SYSTEM.Encryption.Base64Decode(tString)
}
Else
{
Set tOutput = $SYSTEM.Encryption.Base64Encode(tString)
}
Write tOutput
</script>
</td></tr>
</table>
</form>

00
2 0 12 674
Log in or sign up to continue

Replies

Cache version?

Your code runs without errors on 2016.1.

What value are you trying to decode?

Your input is too long, so  it's not a string but rather %CSP.CharacterStream.

I mean can you post it (or any other base64 string giving you an error) here?

I seem unable to reproduce the error.

It's a CCDA in base64

2014.1.4 (Build 803_2U) 

Do you just run the page or put some value in textarea?

If I put a short value like "test" in there it encodes, then I copy the base64 and it decodes. If I copy a real base64 CCD it errrors out. Is it a character limitation?

Based on Alexanders comment, I think this should work.

<form method="post" action="">
<table>
<tr><td><textarea rows="40" cols="200" name="submitstring"></textarea></td></tr>
<tr><td><select name="decodeoption"><option>Decode</option><option>Encode</option></select><input type="submit"/></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><h2>Result</h2></td></tr>
<tr><td>

<script language=Cache runat=server>
Set tString = $Get(%request.Data("submitstring",1))
Set tAction = $Get(%request.Data("decodeoption",1))
If tAction = "Decode" {
    Set tString = $SYSTEM.Encryption.Base64Decode(tString)
    Set tOutput = $ZCONVERT(tString,"I","UTF8")
} Else {
    Set tString = $ZCONVERT(tString,"O","UTF8")
    Set tOutput = $SYSTEM.Encryption.Base64Encode(tString)
}
Write tOutput
</script>
</td></tr>
</table>
</form>

I added  UTF8 conversion:

Set tOutput = $ZCONVERT(tString,"I","UTF8")

and

 Set tString = $ZCONVERT(tString,"O","UTF8")

Similar error.

 

 

A run-time error occurred while executing the page

 

  • Error: <ILLEGAL VALUE>zOnPageHEAD+26^csp.decode.1
    ErrorNo: 5002
    CSP Page: /csp/ensemble/decode.csp
    Namespace: ENSEMBLE
    Class: csp.decode
    Routine: csp.decode.1
    Location: zOnPageHEAD+26
    Line: Set tString = $SYSTEM.Encryption.Base64Decode(tString)


  •