本文介绍了如何在C#的Windows凭据中传递长字符串作为密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我在使用c#和Credential Manager API传递一个长字符串以保存到windows vault文件夹时遇到异常。否则它会成功保存到保险库。 例外情况是I am getting exception while passing a long string to save to the windows vault folder using c# and Credential Manager API. Else it is getting saved successfully to the vault.Exception coming is Specified argument was out of the range of valid values.Parameter name: The password has exceeded 512 bytes.& 传递的密码字符串为 b $ b 我的尝试: &password string passed is "TERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRTGVBFXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDTREEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEECFGBBCVBDRFGDXFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXRETWEREWRW3ERWERWRWRWRRRRRRRRRRRRRRRRRRRRRFDSFFFSDFSFSFSFDSFDDFSFSFSFGRWERWREWRWRWRDXVGFDGFDGFDGFDGDGDFGDGDGDREWRWREWRERRWREWREWRDXVCXBCVVVVVVVVVVVVVVREWRWERRRRRRRRRRREWRWRWREWR"What I have tried:public void SavePassword(string password) { try { using (var cred = new Credential()) { cred.Password = password; cred.Target = PasswordName; cred.Type = CredentialType.Generic; cred.PersistanceType = PersistanceType.LocalComputer; cred.Save(); } } catch(Exception ex) { } } 推荐答案 Parameter name: The password has exceeded 512 bytes. 您的密码长度为600字节,允许的最大密码为512. Your password is 600 bytes long and the maximum allowed is 512. 这篇关于如何在C#的Windows凭据中传递长字符串作为密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 04:59