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很重要;
  • 相关阅读:
    mongo的csv文件参考
    apache安装配置
    部署Java的运行环境
    ubuntu下没有ping命令
    webbench压力测试
    判断当前是否是微信浏览器,还是APP客户端
    PHP uniqid 高并发生成不重复唯一ID
    http_build_query()函数使用方法
    防XSS攻击
    PHP中json_encode()使用须知,JSON数组和JSON对象
  • 原文地址:https://www.cnblogs.com/xiaowy/p/769501.html
Copyright © 2011-2022 走看看