ToBase64 / FromBase64

    <Extension()> _
    Public Function ToBase64(ByVal value As String) As String
        If String.IsNullOrEmpty(value) Then
            Return value
        Else
            Dim encoding As New System.Text.ASCIIEncoding()
            Return Convert.ToBase64String(encoding.GetBytes(value))
        End If
    End Function

    <Extension()> _
    Public Function FromBase64(ByVal value As String) As String
        If String.IsNullOrEmpty(value) Then
            Return value
        Else
            Dim encoding As New System.Text.ASCIIEncoding()
            Return encoding.GetString(Convert.FromBase64String(value))
        End If
    End Function
Example:
Textbox1.Text.ToBase64

db.Password.FromBase64

Description

Convert string to/from Base64 encodeing

Details

Double click on the code to select all.

 

;