Encode and Decode in c# asp.net?

后端 未结 2 2114
后悔当初
后悔当初 2021-02-09 02:54

i am using Encoding and decoding :

For Encoding:

private string EncodeServerName(string ServerName)
    {
      byte[] NameEncodein = new byte[ServerName         


        
2条回答
  •  心在旅途
    2021-02-09 03:36

    the same code works for me, which you written in DecoAndGetServerName().

    the thing is, you need to pass ENCODED STRING to your DecoAndGetServerName() function,

    which might be encoded like :

    string Servername=Convert.ToBase64String(Encoding.UTF8.GetBytes("serverName"));
    

    That's why you got that Error The input is not a valid Base-64 string as it contains a non-base 64 character,....

提交回复
热议问题