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很重要;
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很重要;