我正在自动执行登录过程,在此过程中,我将获得包含特殊字符的不同类型的密码。
我的代码如下,我尝试 UrlEncode() 密码,但没有用。如果您在我的代码中发现任何问题,或者我可以找到解决方法,请告诉我。我的密码是 "aab$#*#%232" 和 "@#:.;$%^&+-_h1&" :
string uriString = "http://" + IP + URI ;
string postData = "";
TraceLine("The uri string is " + uriString);
foreach (string key in values.AllKeys)
{
TraceLine(key + " " + values[key]);
postData += key + "=" + values[key] + "&";}}
if (postData.Length > 0) {
postData = postData.TrimEnd(postData[postData.Length - 1]);
}
TraceLine("The postData string is " + postData);
HttpWebRequest req =(HttpWebRequest)System.Net.WebRequest.Create(uriString);
req.ContentType = "application/x-www-form-urlencoded";
req.KeepAlive = false;
req.Method = "POST";
byte[] …Run Code Online (Sandbox Code Playgroud)