小编Vaa*_*lla的帖子

无法在 http post 请求中发送特殊字符,C#

我正在自动执行登录过程,在此过程中,我将获得包含特殊字符的不同类型的密码。

我的代码如下,我尝试 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)

c# post http

0
推荐指数
1
解决办法
8773
查看次数

标签 统计

c# ×1

http ×1

post ×1