我正在尝试使用 NetworkCredential 类通过 ASP.NET 访问网页。但是,我不断收到以下消息的异常System.Security.Cryptography.CryptographicException: The handle is invalid
下面是我如何尝试调用该函数的代码。任何帮助是极大的赞赏。
C#:
System.Net.WebClient client = new System.Net.WebClient();
client.Credentials = new System.Net.NetworkCredential("Admin", "Nimda");
堆栈跟踪
[CryptographicException: The handle is invalid.
]
System.Security.SecureString.ProtectMemory() +154
System.Security.SecureString.InitializeSecureString(Char* value, Int32 length) +170
System.Security.SecureString..ctor(Char* value, Int32 length) +65
System.Net.SecureStringHelper.CreateSecureString(String plainString) +6181188
System.Net.NetworkCredential..ctor(String userName, String password) +64