zoukankan      html  css  js  c++  java
  • WebClient post data to .aspx page

     1WebClient client = new WebClient();
     2            client.Headers.Add("Accept""image/gif,image/x-xbitmap,image/jpeg,image/pjpeg,application/x-shockwave-flash,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword,*/*");
     3            client.Headers.Add("Accept-Language""zh-cn");
     4            client.Headers.Add("Accept-Encoding""gzip, deflate");
     5            client.Headers.Add("Content-Type""application/x-www-form-urlencoded");
     6
     7            string postString = "";
     8            postString += HttpUtility.UrlEncode("__VIEWSTATE");
     9            postString += "=";
    10            postString += HttpUtility.UrlEncode("/wEPDwUJNzM4ODg2MTUxZGRqlR5kSksCPGmgkbM/P3qjvjwnnQ");
    11            postString += "==";
    12            postString += "&";
    13            postString += HttpUtility.UrlEncode("TextBox1");
    14            postString += "=";
    15            postString += HttpUtility.UrlEncode("aa"); ;
    16            postString += "&";
    17            postString += HttpUtility.UrlEncode("Button2");
    18            postString += "=";
    19            postString += HttpUtility.UrlEncode("Post"); ;
    20            postString += "&";
    21            postString += HttpUtility.UrlEncode("__EVENTVALIDATION");
    22            postString += "=";
    23            postString += HttpUtility.UrlEncode("/wEWQALk4MLTCALs0bLrBgKM54rGBgLs0fbZDAK7q7GGCALs0Yq1BQLs0e58AuzRgtgJAuzRxsYPAuzR2qEIAuzR/rYIAuzRkpIBAqnU7OEDAqrU7OEDAqvU7OEDAqzU7OEDAq3U7OEDAq7U7OEDAq/U7OEDArDU7OEDAqHU7OEDAqLU7OEDAqnUsNAJAqrUsNAJAqvUsNAJAqzUsNAJAq3UsNAJAq7UsNAJAq/UsNAJArDUsNAJAqHUsNAJAqLUsNAJAqnUxKsCAqrUxKsCAqvUxKsCAqzUxKsCAq3UxKsCAq7UxKsCAq/UxKsCArDUxKsCAqHUxKsCAqLUxKsCAqnUqPMNAqrUqPMNAqvUqPMNAqzUqPMNAq3UqPMNAq7UqPMNAq/UqPMNArDUqPMNAqHUqPMNAqLUqPMNAqnUvM4GAqrUvM4GAqvUvM4GAqzUvM4GAq3UvM4GAq7UvM4GAq/UvM4GArDUvM4GAqHUvM4GAqLUvM4GAqnUgL0MAqrUgL0MgYFttUnbBLGCqjUjnWSejeI7wZc");
    24            postString += "=";
    25            byte[] postData = System.Text.Encoding.ASCII.GetBytes(postString);
    26            byte[] returnData = client.UploadData(formatUrl, "POST", postData);
    27            returnString = Encoding.Default.GetString(returnData);
    28
    29            //其中"__VIEWSTATE很重要;
  • 相关阅读:
    N-Queens II
    N-Queens
    Insertion Sort List
    Combination Sum
    Next Permutation
    Permutations II
    Unique Paths II
    【转】Python之mmap内存映射模块(大文本处理)说明
    【转】python之模块array
    【转】python 退出程序的方式
  • 原文地址:https://www.cnblogs.com/xiaowy/p/769501.html
Copyright © 2011-2022 走看看