fork(3) download
  1. using System;
  2. using System.IO;
  3. using System.Net;
  4. using System.Text;
  5. using System.Collections.Generic;
  6.  
  7. namespace ConsoleApplication2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. while (true)
  14. {
  15. List<Cookie> receivedCookie = new List<Cookie>();
  16.  
  17. string target = "https://e...content-available-to-author-only...i.org/s/8f78284972/1033793-1";
  18. string src = string.Empty;
  19.  
  20. HttpWebRequest httpReq = null;
  21. HttpWebResponse httpRes = null;
  22.  
  23. httpReq = (HttpWebRequest)WebRequest.Create(target);
  24.  
  25. CookieCollection cookiecollection = new CookieCollection();
  26.  
  27. Cookie[] cookie = {
  28. new Cookie("ipb_member_id", "931684"),
  29. new Cookie("ipb_pass_hash", "5134e15bc0d30efe85e6bcfe76cdcdd9")
  30. };
  31.  
  32. for (int i = 0; i < cookie.Length; i++)
  33. {
  34. cookie[i].Domain = "exhentai.org";
  35. cookie[i].Expires = DateTime.Now.AddYears(2);
  36. cookiecollection.Add(cookie[i]);
  37. }
  38.  
  39. foreach (Cookie item in receivedCookie)
  40. cookiecollection.Add(item);
  41.  
  42. receivedCookie.Clear();
  43.  
  44. httpReq.CookieContainer = new CookieContainer();
  45. httpReq.CookieContainer.Add(cookiecollection);
  46. httpReq.Headers["Accept-Encoding"] = "gzip";
  47. httpReq.AutomaticDecompression = DecompressionMethods.GZip;
  48.  
  49. var list = httpReq.CookieContainer.GetCookies(new Uri("https://e...content-available-to-author-only...i.org"));
  50.  
  51. foreach(Cookie item in list)
  52. Console.WriteLine("Cookie.Name = {0}, Cookie.Value = {1}, Cookie.Domain = {2},Cookie.Expired = {3}",item.Name, item.Value,item.Domain,item.Expires);
  53.  
  54. httpRes = (HttpWebResponse)httpReq.GetResponse();
  55.  
  56. foreach (Cookie _cookie in httpRes.Cookies)
  57. receivedCookie.Add(_cookie);
  58.  
  59. Stream st = httpRes.GetResponseStream();
  60.  
  61. using (StreamReader sr = new StreamReader(st, Encoding.UTF8))
  62. src = sr.ReadToEnd();
  63.  
  64. Console.WriteLine(src);
  65.  
  66. Console.ReadKey();
  67. }
  68.  
  69. }
  70. }
  71. }
  72.  
Runtime error #stdin #stdout #stderr 0.12s 350848KB
stdin
Standard input is empty
stdout
Cookie.Name = ipb_member_id, Cookie.Value = 931684, Cookie.Domain = exhentai.org,Cookie.Expired = 3/4/2019 11:24:00 PM
Cookie.Name = ipb_pass_hash, Cookie.Value = 5134e15bc0d30efe85e6bcfe76cdcdd9, Cookie.Domain = exhentai.org,Cookie.Expired = 3/4/2019 11:24:00 PM
stderr
Unhandled Exception:
System.Net.WebException: Error: NameResolutionFailure
  at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00064] in <bd46d4d4f7964dfa9beea098499ab597>:0 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in <bd46d4d4f7964dfa9beea098499ab597>:0 
  at ConsoleApplication2.Program.Main (System.String[] args) [0x001b3] in <cc3a986eeb174d5c9177de95795b259c>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.Net.WebException: Error: NameResolutionFailure
  at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00064] in <bd46d4d4f7964dfa9beea098499ab597>:0 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in <bd46d4d4f7964dfa9beea098499ab597>:0 
  at ConsoleApplication2.Program.Main (System.String[] args) [0x001b3] in <cc3a986eeb174d5c9177de95795b259c>:0