title: WebClient Log in website with hidden random input
body: <p>I want to login a website with WebClient.
  The login-form:</p>
  
  <pre><code>&lt;input id="txtID" name="txtID" type="text" maxlength="20" onfocus="javascript:setUserNameData(this);" onblur="javascript:checkUserNameData(this);" value="Tên Truy Cập" /&gt;
  &lt;input id="txtPW" name="txtPW" type="text" maxlength="12" onfocus="this.value='';setPWDXXX();" onblur="javascript:checkPWData(this);" oninput="setPWDXXX();" value="Mật Khẩu" /&gt;
  &lt;input id="hidubmit" name="hidubmit" type="hidden" /&gt;
   &lt;input id="IEVerison" type="hidden" name="IEVerison" value="0" /&gt;
                  &lt;input type="hidden" id="detecResTime" name="detecResTime" value="" /&gt;
   &lt;input id="detecas-analysis" type="hidden" name="detecas-analysis" value="{}" /&gt;
   &lt;input type="hidden" name="hidServerKey" value="bong88.com" /&gt;
  &lt;input name="tk" type="hidden" id="tk" value="25af27e2101f14442f89c7f1f20f08c951c82c6f5582ae" runat="server" /&gt;
  &lt;input id="IsSSL" name="IsSSL" type="hidden" /&gt;
  </code></pre>
  
  <p>
      </p>
  
  <p>With 2 value txtCode and __tk change each time enter website.
  I tried to get the source, get the values then send request to website but I failed.
  Did I wrong or miss something?</p>
  
  <p>Mycode:</p>
  
  <pre><code> private string GetSourceForMyShowsPage()
      {
          using (var client = new WebClientEx() )
          {
              client.Headers.Add("User-Agent: Other");
              var htmlDoc = new HtmlAgilityPack.HtmlDocument();
              string html = client.DownloadString("https://www.bong88.com/login888.aspx?IsSSL=1");
              htmlDoc.LoadHtml(html);
  
              string txtCode = htmlDoc.GetElementbyId("txtCode").GetAttributeValue("value", "");
              string tk = htmlDoc.GetElementbyId("__tk").GetAttributeValue("value", "");
              var values = new NameValueCollection
              {
                  { "txtID", "" },
                  { "txtPW", "" },
                  {"txtCode", txtCode },
                  { "hidubmit",""},
                  { "IEVerison","0" },
                  {" detecResTime","" },
                  { "detecas-analysis", "{}"},
                  { "hidServerKey",".com" },
                  { "__tk", tk },
                  { "IsSSL", "1" },
                  { "PF", "Default"},
                  { "RMME", "on" },
              };
              // Authenticate
              client.UploadValues("https://www.bong88.com/login888.aspx?IsSSL=1", values);
               //Download desired page
  
              return client.DownloadString("https://nvlai.bong88.com/sports");
  
  
          }
      }
   public class WebClientEx : WebClient
  {
      public CookieContainer CookieContainer { get; private set; }
  
      public WebClientEx()
      {
          CookieContainer = new CookieContainer();
  
      }
  
      protected override WebRequest GetWebRequest(Uri address)
      {
          var request = base.GetWebRequest(address);
          if (request is HttpWebRequest)
          {
              (request as HttpWebRequest).CookieContainer = CookieContainer;
          }
          return request;
      }
  }
  </code></pre>
  
  <p>I think the values between <code>string html = client.DownloadString("https://www.bong88.com/login888.aspx?IsSSL=1");</code></p>
  
  <p>and <code>client.UploadValues("https://www.bong88.com/login888.aspx?IsSSL=1", values);</code>
  is different. So I failed</p>