Not enough points to comment, but in case it helps, the code snippet that Sushil found in the link provided (JSON Web Signature ietf draft) works for when encoding Base 64 as a parameter in URL.

Copied snippet below for those that are lazy:

 static string Base64UrlEncode(byte[] arg)
 {
 string s = Convert.ToBase64String(arg); // Regular base64 encoder
 s = s.Split('=')[0]; // Remove any trailing '='s
 s = s.Replace('+', '-'); // 62nd char of encoding
 s = s.Replace('/', '_'); // 63rd char of encoding
 return s;
 }

 static byte[] Base64UrlDecode(string arg)
 {
 string s = arg;
 s = s.Replace('-', '+'); // 62nd char of encoding
 s = s.Replace('_', '/'); // 63rd char of encoding
 switch (s.Length % 4) // Pad with trailing '='s
 {
 case 0: break; // No pad chars in this case
 case 2: s += "=="; break; // Two pad chars
 case 3: s += "="; break; // One pad char
 default: throw new System.Exception(
 "Illegal base64url string!");
 }
 return Convert.FromBase64String(s); // Standard base64 decoder
 }