Hi there,
I could send you the file, but I don't think it would help you much. There's an awful lot of ASP.NET 'plumbing' code and very little base64 code.
Instead, here's a sample program I just wrote that shows how to do the base64 encoding and decoding in .NET. It's in C# - scroll down for the VB.NET version:
using System;
using System.Text;
public class Base64Decoder
{
public static void Main ()
{
string inputText = "This is some text.";
Console.Out.WriteLine ("Input text: {0}", inputText);
byte [] bytesToEncode = Encoding.UTF8.GetBytes (inputText);
string encodedText = Convert.ToBase64String (bytesToEncode);
Console.Out.WriteLine ("Encoded text: {0}", encodedText);
byte [] decodedBytes = Convert.FromBase64String (encodedText);
string decodedText = Encoding.UTF8.GetString (decodedBytes);
Console.Out.WriteLine ("Decoded text: {0}", decodedText);
Console.Out.Write ("Press enter to finish.");
Console.In.ReadLine ();
return;
}
}
Here's my attempt at translating that to VB.NET. I'm not a VB.NET programmer, so I may have done something silly. It seems to work though.
imports Microsoft.VisualBasic
imports System
Imports System.Text
public module Base64Decoder
sub Main
Dim inputText As String
inputText = "This is some text."
Console.Out.WriteLine ("Input text: {0}", inputText)
Dim bytesToEncode As Byte()
bytesToEncode = Encoding.UTF8.GetBytes (inputText)
Dim encodedText As String
encodedText = Convert.ToBase64String (bytesToEncode)
Console.Out.WriteLine ("Encoded text: {0}", encodedText)
Dim decodedBytes As byte()
decodedBytes = Convert.FromBase64String (encodedText)
Dim decodedText As String
decodedText = Encoding.UTF8.GetString (decodedBytes)
Console.Out.WriteLine ("Decoded text: {0}", decodedText)
Console.Out.Write ("Press enter to finish.")
Console.In.ReadLine ()
end sub
end module
If you don't want to mess around with byte arrays, you can just use Convert.ToBase64String and Convert.FromBase64String, but doing the conversion to/from a byte array gives you a bit more control if you're faced with strange character encodings.
Hope this helps,
Geoff