Based on the comments, it looks like HttpServerUtility.UrlTokenEncode doing the right thing, except for the extra character to fill in. Therefore, you should be able to:
string customBase64 = HttpServerUtility.UrlTokenEncode(data); string rfc4648 = customBase64.Substring(0, customBase64.Length - 1);
However, you must add unit tests to check if it really uses the alphabet RFC 4648 (and the same as RFC 4648). Somewhat surprisingly, the docs are so scarce :(
Jon Skeet Nov 04 '14 at 12:45 2014-11-04 12:45
source share