fork download
  1. // Cookie関連
  2. [DllImport("wininet.dll", EntryPoint = "InternetSetCookie", ExactSpelling = false, CharSet = CharSet.Unicode, SetLastError = true)]
  3. static extern bool InternetSetCookie(string domain, string name, string value);
  4.  
  5. public static void SetCookie(string domain, string name, string value)
  6. {
  7. if (!InternetSetCookie(domain, name, value))
  8. throw new Exception("Exception setting Cookie: Win32 Error");
  9. }
  10.  
  11. [DllImport("wininet.dll", EntryPoint = "InternetGetCookie", CharSet = CharSet.Unicode, SetLastError = true)]
  12. public static extern bool InternetGetCookie(string domain, string name, StringBuilder value, ref int size);
  13.  
  14. public static string RetriveIECookies(string domain)
  15. {
  16. StringBuilder cookie = new StringBuilder(new String(' ', 256), 256);
  17. int size = cookie.Length;
  18.  
  19. if (!InternetGetCookie(domain, null, cookie, ref size))
  20. {
  21. if (size < 0) return String.Empty;
  22.  
  23. new StringBuilder(size);
  24. InternetGetCookie(domain, null, cookie, ref size);
  25. }
  26.  
  27. return cookie.ToString();
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(3,21): error CS0439: An extern alias declaration must precede all other elements
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty