fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Text.RegularExpressions;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using System.IO;
  12. using System.Net;
  13. using System.Dynamic;
  14. using HtmlAgilityPack;
  15.  
  16. namespace entropedizer
  17. {
  18. public partial class Form1 : Form
  19. {
  20. public Form1()
  21. {
  22. InitializeComponent();
  23. }
  24.  
  25. public String postRequest(string url, string eventTarget)
  26. {
  27. // A "pre-request," sent to gather SessionID and POST data parameters for the main request
  28. HttpWebRequest prequest = (HttpWebRequest)WebRequest.Create("http://w...content-available-to-author-only...a.info/Chart.aspx?chart=Chart");
  29. HttpWebResponse presponse = (HttpWebResponse)prequest.GetResponse();
  30. Stream pstream = presponse.GetResponseStream();
  31. StreamReader psr = new StreamReader(pstream);
  32. string phtml = psr.ReadToEnd();
  33.  
  34. Match viewstate = Regex.Match(phtml, "id=\"__VIEWSTATE\".+/>");
  35. Match eventvalidation = Regex.Match(phtml, "id=\"__EVENTVALIDATION\".+/>");
  36. ASCIIEncoding encoding = new ASCIIEncoding();
  37. string postData = "__EVENTTARGET=" + eventTarget + "&__VIEWSTATE=" + Uri.EscapeDataString(viewstate.ToString().Substring(24, viewstate.Length - 28)) + "&__EVENTVALIDATION=" + Uri.EscapeDataString(eventvalidation.ToString().Substring(30, eventvalidation.Length - 34));
  38. byte[] data = encoding.GetBytes(postData);
  39.  
  40. // The main request, intended to retreive the desired HTML
  41. HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://w...content-available-to-author-only...a.info/Chart.aspx?chart=Chart");
  42. request.Method = "POST";
  43. request.ContentType = "application/x-www-form-urlencoded";
  44.  
  45. request.CookieContainer = new CookieContainer();
  46. Cookie sessionId = new Cookie("ASP.NET_SessionId", Regex.Match(presponse.Headers.ToString(), "ASP.NET_SessionId=.+ d").ToString().Substring(18, Regex.Match(presponse.Headers.ToString(), "ASP.NET_SessionId=.+ d").Length - 21), "/", ".entropedia.info");
  47. request.CookieContainer.Add(new Uri("http://w...content-available-to-author-only...a.info/Chart.aspx?chart=Chart"), sessionId);
  48.  
  49. Stream stream = request.GetRequestStream();
  50. stream.Write(data, 0, data.Length);
  51. stream.Close();
  52.  
  53. HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  54. stream = response.GetResponseStream();
  55.  
  56. StreamReader sr = new StreamReader(stream);
  57.  
  58. return sr.ReadToEnd();
  59. }
  60.  
  61. private void Form1_Load(object sender, EventArgs e)
  62. {
  63. System.Net.ServicePointManager.Expect100Continue = false;
  64.  
  65. HtmlAgilityPack.HtmlDocument hChart = new HtmlAgilityPack.HtmlDocument();
  66. hChart.LoadHtml(postRequest("http://w...content-available-to-author-only...a.info/Chart.aspx?chart=Chart", "ctl00%24ContentPlaceHolder1%24DG1%24ctl19%24ctl05"));
  67.  
  68. HtmlNodeCollection chartStrings = hChart.DocumentNode.SelectNodes("/html/body/form");
  69.  
  70. CheckedListBox chartOptions = new CheckedListBox();
  71. foreach (HtmlNode i in chartStrings)
  72. {
  73. chartOptions.Items.Add(chartStrings[i].ToString());
  74. }
  75. this.Controls.Add(chartOptions);
  76. }
  77. }
  78. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(4,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(9,24): error CS0234: The type or namespace name `Tasks' does not exist in the namespace `System.Threading'. Are you missing an assembly reference?
prog.cs(10,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(13,14): error CS0234: The type or namespace name `Dynamic' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(14,7): error CS0246: The type or namespace name `HtmlAgilityPack' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 5 error(s), 0 warnings
stdout
Standard output is empty