使用httpwebrequest向服务器发包,一直是服务器繁忙怎么办。

qzyf1992 2012-12-23 05:40:52
纠结了一下午了蛋都碎了。。
...全文
210 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
qzyf1992 2012-12-24
  • 打赏
  • 举报
回复

  private string getUrlRespHtml(string url, Dictionary<string, string> postDict)
        {
            string respHtml = "";

            //HttpWebResponse resp = getUrlResponse(url, headerDict, postDict, timeout);
            HttpWebResponse resp = getUrlResponse(url, postDict, "");

            //long realRespLen = resp.ContentLength;

            StreamReader sr;

            sr = new StreamReader(resp.GetResponseStream(), System.Text.Encoding.GetEncoding("GB2312"));

            respHtml = sr.ReadToEnd();

            return respHtml;



        }
qzyf1992 2012-12-24
  • 打赏
  • 举报
回复

 private string getUrlRespHtml(string url, Dictionary<string, string> postDict)
        {
            string respHtml = "";

            //HttpWebResponse resp = getUrlResponse(url, headerDict, postDict, timeout);
            HttpWebResponse resp = getUrlResponse(url, postDict, "");

            //long realRespLen = resp.ContentLength;

            StreamReader sr;

            sr = new StreamReader(resp.GetResponseStream(),     System.Text.Encoding.GetEncoding("GB2312"));

            respHtml = sr.ReadToEnd();

            return respHtml;



        }
qzyf1992 2012-12-24
  • 打赏
  • 举报
回复
  string loginRespHtml = null;
Dictionary<string, string> postDict = new Dictionary<string, string>();
postDict.Add("__VIEWSTATE", "dDwtMTUxNzM0MjM0Mjs7Pot0nxzpyf7s6ZEFm%2F41QONw9iU9");
//postDict.Add("codestring", "");
postDict.Add("TextBox1",textBox1.Text);
postDict.Add("TextBox2", textBox2.Text);
postDict.Add("RadioButtonList1", "%D1%A7%C9%FA");
postDict.Add("Button1", "");
postDict.Add("lbLanguage", "");
string baiduMainUrl = "http://61.139.105.138/xs_main.aspx";

loginRespHtml = getUrlRespHtml(baiduMainUrl, postDict);

MessageBox.Show(loginRespHtml);
webBrowser1.Navigate("about:blank");
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
webBrowser1.Document.Write(ConvertExtendedASCII(loginRespHtml));
这是按按钮登录的代码。
myhope88 2012-12-24
  • 打赏
  • 举报
回复
忙不过来了?
  • 打赏
  • 举报
回复
当然还有一种,就是人家服务器程序故意“忍辱负重”给你一个“系统正忙!”的假信息,认为碰上流氓软件了。
YiYanXiYin 2012-12-23
  • 打赏
  • 举报
回复
通过浏览器访问正常?如果是这样,贴出你的代码
  • 打赏
  • 举报
回复
服务器程序太垃圾了,没有办法。

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧