Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting to Base64
Message
From
26/08/2010 00:15:49
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Converting to Base64
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01478537
Message ID:
01478537
Views:
99
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
Next
Reply
Map
View

Click here to load this message in the networking platform