[C#] 纯文本查看 复制代码 static class WebServer
{
public static void Login(string username,string password){
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://localhost/think/index.php/Index/login",
Method = "post",//URL 可选项 默认为Get
Encoding = null,//编码格式(utf-8,gb2312,gbk)
};
string tmppost="username=$username&password=$password";
tmppost = tmppost.Replace("$username",username);
tmppost = tmppost.Replace("$password", password);
item.Postdata = tmppost;
HttpResult result = http.GetHtml(item);
System.Diagnostics.Trace.WriteLine(result.Html);
}
}
调试输出,返回的汉字都是乱码了。我觉得我用的方式好像没什么错误!站长看看怎么回事呀。
|