微软官方从.NET Framework 4之后不再支持System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(string password, string passwordFormat)方法。MD5加密需要自行实现。需要注意的是该方法加密结果是小写,而
HashPasswordForStoringInConfigFile加密结果是大写

public static string MD5Encrypt(string input)
{
	StringBuilder builder = new StringBuilder();
        using (MD5CryptoServiceProvider md5Crypto = new MD5CryptoServiceProvider())
        {
            byte[] data = md5Crypto.ComputeHash(Encoding.UTF8.GetBytes(input));
            for (int i = 0; i < data.Length; i++)
            {
                builder.Append(data[i].ToString("x2"));
            }
        }
        return builder.ToString();
}