Decode base64 string C# -


i tried decode following base64 string in c#:

pglmcmftzsbzcmm9imh0dha6ly9lbwjlzc5yzwr0dwjllmnvbs8\/awq9mzg1njamymdjb2x vcj0wmdawmdaiigzyyw1lym9yzgvypsiwiib3awr0ad0indm0iibozwlnahq9ijm0ncigc2nyb2xsaw5n psjubyigywxsb3dmdwxsc2nyzwvupjwvawzyyw1lpg== 

but i'm getting error:

the input not valid base-64 string contains non-base 64  character, more 2 padding characters, or illegal character among padding characters. 

even if remove last

= 

in string above still same error.

here code use:

    byte[] decodedbytes = convert.frombase64string(embedcode);     string decodedtext = encoding.utf8.getstring(decodedbytes); 

why that?

thank you.

the correct base64string is:

pglmcmftzsbzcmm9imh0dha6ly9lbwjlzc5yzwr0dwjllmnvbs8/awq9mzg1njamymdjb2x vcj0wmdawmdaiigzyyw1lym9yzgvypsiwiib3awr0ad0indm0iibozwlnahq9ijm0ncigc2nyb2xsaw5n psjubyigywxsb3dmdwxsc2nyzwvupjwvawzyyw1lpg== 

well not valid base64string. base64string can not have \ character. remove character , work


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -