编码和解码错误:base-64字符串中的无效字符。 [英] encode and decode error: invalid character in a base-64 string.

查看:123
本文介绍了编码和解码错误:base-64字符串中的无效字符。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



你可以建议我如何解决这个错误。



错误: Base-64字符串中的字符无效。



我以编码格式发送查询字符串并将其检索到另一页并对其进行解码。执行编码和解码使用两种方法提到了。



 txtclientcode.Text = Page.Request.Form [   clientcode]。ToString(); 
TextBox1.Text = DecodeTo64UTF8(txtclientcode.Text.ToString());





和方法是



 私人 静态 < span class =code-keyword> string  EncodeTo64UTF8( string  str)
{

byte [] toEncode2Bytes = System.Text.Encoding.UTF8.GetBytes(str);

string sReturnValue = System.Convert.ToBase64String(toEncode2Bytes);

return sReturnValue;

}

private static string DecodeTo64UTF8( string eValue)
{

byte [] encodedDataBytes = System.Convert.FromBase64String(eValue);

string sReturnValue = System.Text.Encoding.UTF8.GetString(encodedDataBytes);

return sReturnValue;

}





谢谢,

Pinank Kella。

解决方案

该错误意味着您的编码字符串进入中断。它可能在整个过程中被修改过,使用调试器来检查与编码方法相关的值。


我试图检查你的代码。

但它工作正常,所以我认为你的另一个代码发送查询字符串或其他任何东西都有问题。



i测试它就像这样它会工作正常。



 私人  static   string  EncodeTo64UTF8( string  str)
{
byte [] toEncode2Bytes = System.Text.Encoding.UTF8.GetBytes(str);

string sReturnValue = System.Convert.ToBase64String(toEncode2Bytes);

return sReturnValue;
}

private static 字符串 DecodeTo64UTF8(字符串 eValue)
{

byte [] encodedDataBytes = System.Convert.FromBase64String(eValue);

string sReturnValue = System.Text.Encoding.UTF8.GetString(encodedDataBytes);

return sReturnValue;

}

受保护 void EncodeDecodTest()
{
string str = ID = 43&安培;名称= 'XYZ';
string encode = EncodeTo64UTF8(str);
string decode = DecodeTo64UTF8(encode);
}


我想解密密码是ฆฉ但错误无效字符一个基地 - 64位。如何解密密码?

Hello guys,

can u suggest me how to solved this error.

Error: "Invalid character in a Base-64 string".

I am sending query string in encoded format and Retrieved it on another page and decode it.Encode and Decode is performed using two methods mentions bellowed.

txtclientcode.Text = Page.Request.Form["clientcode"].ToString();
TextBox1.Text = DecodeTo64UTF8(txtclientcode.Text.ToString());



and methods are

private static string EncodeTo64UTF8(string str)
{

    byte[] toEncode2Bytes = System.Text.Encoding.UTF8.GetBytes(str);

    string sReturnValue = System.Convert.ToBase64String(toEncode2Bytes);

    return sReturnValue;

}

private static string DecodeTo64UTF8(string eValue)
{

   byte[] encodedDataBytes = System.Convert.FromBase64String(eValue);

   string sReturnValue = System.Text.Encoding.UTF8.GetString(encodedDataBytes);

   return sReturnValue;

}



Thanks,
Pinank Kella.

解决方案

The error means that your encoded string going in, is broken. It's probably been modified along the way, use the debugger to check the value coming out against what comes out of the encode method.


i tried to check your code.
but it's working fine, so i think there is some thing wrong to your another code for sending query string or anything else.

i test it like this and it will working fine.

private static string EncodeTo64UTF8(string str)
        {
            byte[] toEncode2Bytes = System.Text.Encoding.UTF8.GetBytes(str);

            string sReturnValue = System.Convert.ToBase64String(toEncode2Bytes);

            return sReturnValue;
        }

        private static string DecodeTo64UTF8(string eValue)
        {

            byte[] encodedDataBytes = System.Convert.FromBase64String(eValue);

            string sReturnValue = System.Text.Encoding.UTF8.GetString(encodedDataBytes);

            return sReturnValue;

        }

        protected void EncodeDecodTest()
        {
            string str = "id=43&name='xyz'";
            string encode = EncodeTo64UTF8(str);
            string decode = DecodeTo64UTF8(encode);
        }


I want to decrypt password is "ฆฉ but error Invalid character a Base - 64 bit .how to do decrypt password?


这篇关于编码和解码错误:base-64字符串中的无效字符。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆