登录提交URL:http://eo.gyyx.cn/Page/User/Login.aspx
用户名:y1318
密码:w1
模拟登录的我做好了
提交表单URL:http://eo.gyyx.cn/Page/NetbarLog/NetbarInfoAdd.aspx
我想填写网吧名称,网吧IP
一直提交不成功!求帮助!

解决方案 »

  1.   

    不成功需要,贴出,错误信息
    参考代码
    public static string HttpGetHtmlSource(string url, string encodingName, HttpMethod httpMethod, Dictionary<string, string> postData)
       {
       System.Text.Encoding encoding= System.Text.Encoding.GetEncoding(encodingName);
       System.Net.WebResponse response = GetWebReponse(url, httpMethod, postData, encoding);
       System.IO.Stream stream = response.GetResponseStream();
       System.IO.StreamReader reader = new System.IO.StreamReader(stream, encoding);
       string html = reader.ReadToEnd();
       stream.Close();
       reader.Close();
       response.Close();
       return html;
       }
    public static string HttpGetHtmlSource(string url, string encodingName, HttpMethod httpMethod, Dictionary<string, string> postData)
       {
       System.Text.Encoding encoding= System.Text.Encoding.GetEncoding(encodingName);
       System.Net.WebResponse response = GetWebReponse(url, httpMethod, postData, encoding);
       System.IO.Stream stream = response.GetResponseStream();
       System.IO.StreamReader reader = new System.IO.StreamReader(stream, encoding);
       string html = reader.ReadToEnd();
       stream.Close();
       reader.Close();
       response.Close();
       return html;
       }
    public static string GetHttpPostData(System.Text.Encoding encoding, Dictionary<string, string> postData)
       {
       if (postData == null || postData.Count < 1)
       {
       return null;
       }
       StringBuilder sbData = new StringBuilder();
       foreach (var item in postData)
       {
       sbData.AppendFormat("{0}={1}&", HttpUtility.UrlEncode(item.Key, encoding), HttpUtility.UrlEncode(item.Value, encoding));
       }
       if (sbData.Length > 0)
       {
       sbData.Length = sbData.Length - 1;
       }
       return sbData.ToString();
       }
      

  2.   

    楼上的兄弟,能帮我POST这个地址吗?http://eo.gyyx.cn/Page/NetbarLog/NetbarInfoAdd.aspx
    我试了很多,都不行,从凌晨写到现在还没写好!!!!
      

  3.   

    呵呵,试下gb2312 或改utf-8 :
    string relust = GetUrltoHtml("http://eo.gyyx.cn/Page/NetbarLog/NetbarInfoAdd.aspx","gb2312"); public static string GetUrltoHtml(string Url,string type)
      {
      try
      {
      System.Net.WebRequest wReq = System.Net.WebRequest.Create(Url);
      // Get the response instance.
      wReq.Method = "post";
      System.Net.WebResponse wResp = wReq.GetResponse();
      System.IO.Stream respStream = wResp.GetResponseStream();
      // Dim reader As StreamReader = New StreamReader(respStream)
      using (System.IO.StreamReader reader = new System.IO.StreamReader(respStream, Encoding.GetEncoding(type)))
      {
      return reader.ReadToEnd();
      }
      }
      catch (System.Exception ex)
      {
      //errorMsg = ex.Message;
      }
      return "";
      }
      

  4.   

    地址:http://eo.gyyx.cn/Page/NetbarLog/NetbarInfoAdd.aspx
    朋友,我想填写网吧名称,网吧IP
    然后POST提交表单。不是获取内容哦
      

  5.   

    源码地址:http://download.csdn.net/detail/johnwanzhi/3909477
    登录的我写好了,就是提交表单不成功,求帮助啊!!!!!