Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting to Base64
Message
De
26/08/2010 00:15:49
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Converting to Base64
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01478537
Message ID:
01478537
Vues:
100
I am using this to XML a file into a Base64 syntax:
Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(lcXml))
And, I am using this to do the reverse process:
        ' Create a file
        ' expC1 Node
        ' expC2 File
        Public Function CreateFile(ByVal tcXML As String, ByVal tcFile As String) As Boolean
            Dim lcFile As String = ""
            Dim loByte() As Byte = Nothing
            Dim loFileStream As System.IO.FileStream = Nothing

            ' Reset the values
            cError = ""

            Try
                ReDim loByte(tcXML.Length)

                ' Decode the value
                loByte = Convert.FromBase64String(tcXML)

                ' Create the file
                loFileStream = New System.IO.FileStream(tcFile, System.IO.FileMode.Create)

                ' Write the file
                loFileStream.Write(loByte, 0, loByte.Length)

                ' Close the file
                loFileStream.Close()

            Catch loError As Exception
                cError = loError.Message
                Return False
            End Try

            Return True
        End Function
But, obviously, I do not end up with the same file. So, something is wrong in my process. Anyone would be able to know the proper way to get the file back?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform