public static string Base64Decode(string Message){if((Message.Length%4)!=0){ throw new ArgumentException("不是正确的BASE64编码,请检查。","Message"); } if(!System.Text.RegularExpressions.Regex.IsMatch(Message,"^[A-Z0-9/+=]*$",System.Text.RegularExpressions.RegexOptions.IgnoreCase)){ throw new ArgumentException("包含不正确的BASE64编码,请检查。","Message"); } }
{
try { Convert.FromBase64String(s); }
catch { return false; }
return true;
}
throw new ArgumentException("不是正确的BASE64编码,请检查。","Message");
}
if(!System.Text.RegularExpressions.Regex.IsMatch(Message,"^[A-Z0-9/+=]*$",System.Text.RegularExpressions.RegexOptions.IgnoreCase)){
throw new ArgumentException("包含不正确的BASE64编码,请检查。","Message");
}
}