base-64 char数组或字符串的长度无效。 [英] Invalid length for a base-64 char array or string.
本文介绍了base-64 char数组或字符串的长度无效。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public ActionResult CreditNote(string CNId)
{
Int64 crnId = 0;
//试试
// {
if(!string.IsNullOrEmpty(CNId))
{
crnId = Convert.ToInt64(System.Text.Encoding .UTF8.GetString((Convert.FromBase64String(CNId))));
}
我的尝试:
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))));
}
推荐答案
Base64字符串必须是4个字符的倍数,我猜你的 CNId
不是。请参阅 Base64 - 维基百科 [ ^ ]有关Base64规则的详细说明,包括填充。
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.
这篇关于base-64 char数组或字符串的长度无效。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文