Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public ActionResult CreditNote(string CNId)
{
Int64 crnId = 0;
//try
//{
if (!string.IsNullOrEmpty(CNId))
{
crnId = Convert.ToInt64(System.Text.Encoding.UTF8.GetString((Convert.FromBase64String(CNId))));
}

What I have tried:

public ActionResult CreditNote(string  CNId)
        {
            Int64 crnId = 0;
            //try
            //{
                if (!string.IsNullOrEmpty(CNId))
                {
                    crnId = Convert.ToInt64(System.Text.Encoding.UTF8.GetString((Convert.FromBase64String(CNId))));
                }
Posted
Updated 11-Mar-19 20:27pm

1 solution

Base64 strings must be a multiple of 4 characters, and I'm guessing your CNId is not. See Base64 - Wikipedia[^] for a good description of the Base64 rules, including padding.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900