Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(im.Groups[1].Value);
  2. req.MaximumAutomaticRedirections = 5;
  3. req.Method = "HEAD";
  4. req.Accept = "*/*";
  5. req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36";
  6. req.Headers.Add("Accept-Encoding", "gzip, deflate, sdch");
  7. req.Headers.Add("Accept-Language", "en-US,en;q=0.8");
  8. req.Headers.Add("Upgrade-Insecure-Requests", "1");
  9. req.Referer = m.Value;
  10. if (!String.IsNullOrWhiteSpace(this.lastSetCookie))
  11. {
  12. CookieContainer cc = new CookieContainer();
  13. string[] cookie_sections = this.lastSetCookie.Split(';');
  14. Dictionary<String, String> cookie_arge = new Dictionary<string, string>();
  15. foreach(String cookie_section in cookie_sections)
  16. {
  17. cookie_arge.Add(cookie_section.Split('=')[0].Trim(), cookie_section.Split('=')[1].Trim());
  18. }
  19. cc.Add(new Uri("http://deviantart.com"), new Cookie("userinfo",cookie_arge["userinfo"]));
  20. }
  21.  
  22. HttpWebResponse res = (HttpWebResponse)req.GetResponse();
  23. image_url = res.ResponseUri.AbsoluteUri;
  24. res.Close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement