Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,845 questions

51,766 answers

573 users

How to use Base64 to encode and decode a string in VB.NET

1 Answer

0 votes
Imports System
 
Public Class Base64EncodeDecode_VB_NET
    Public Shared Function Base64Encode(ByVal str As String) As String
        Dim bytes = System.Text.Encoding.UTF8.GetBytes(str)
         
        Return System.Convert.ToBase64String(bytes)
    End Function
 
    Public Shared Function Base64Decode(ByVal EncodeStr As String) As String
        Dim bytesArray As Byte() = System.Convert.FromBase64String(EncodeStr)
         
        Return System.Text.ASCIIEncoding.ASCII.GetString(bytesArray)
    End Function
 
    Public Shared Sub Main()
        Dim Base64EncodeStr As String = Base64Encode("vb.net programming")
         
        Console.WriteLine(Base64EncodeStr)
         
        Console.WriteLine(Base64Decode(Base64EncodeStr))
    End Sub
End Class
 
 
  
' run:
' 
' dmIubmV0IHByb2dyYW1taW5n
' vb.net programming
'

 



answered Nov 20, 2024 by avibootz
edited Nov 20, 2024 by avibootz

Related questions

1 answer 87 views
1 answer 85 views
1 answer 85 views
2 answers 115 views
1 answer 245 views
1 answer 156 views
...