将空数据错误发布到网站

时间:2014-02-19 20:59:53

标签: c# class post web

我想使用表单应用将数据发布到网站。我在叫一个班级

     string name = pst.Text;
    WebClientEx Wex = new WebClientEx(name);

并在课堂上:

public class WebClientEx : WebClient
    {
        public CookieContainer _cookies = new CookieContainer(); 

       public string Newpost;
       public  WebClientEx(string name)
       {
           name = Newpost;

       }

我用这种方法发布数据:

public string getPost()
       {         
            WebClientEx client = new WebClientEx();
            CQ dom = CQ.Create(Page);
                  data.Add("value", Newpost);

然而Newpost总是空的。你能救我吗?

1 个答案:

答案 0 :(得分:1)

我想你想做

public  WebClientEx(string name)
   {
       Newpost = name;
   }