If UrlTokenDecode
will get the job done, why not use it? I know you are using .NET 1.1, but you can use Reflector to decompile the method from the 2.0 framework and then create your own version.
Here's the underlying code for that method. I've not tested it, but I imagine that if you add this as a method to a class in your project you should be off and running...
internal byte[] UrlTokenDecode(string input)
{
if (input == null)
{
throw new ArgumentNullException("input");
}
int length = input.Length;
if (length < 1)
{
return new byte[0];
}
int num2 = input[length - 1] - '0';
if ((num2 < 0) || (num2 > 10))
{
return null;
}
char[] inArray = new char[(length - 1) + num2];
for (int i = 0; i < (length - 1); i++)
{
char ch = input[i];
switch (ch)
{
case '-':
inArray[i] = '+';
break;
case '_':
inArray[i] = '/';
break;
default:
inArray[i] = ch;
break;
}
}
for (int j = length - 1; j < inArray.Length; j++)
{
inArray[j] = '=';
}
return Convert.FromBase64CharArray(inArray, 0, inArray.Length);
}