I edited this for better readability. This is also a different question
The purpose of this code is to convert a CookieContainer object to a HashTable for later conversion to a CookieCollection. I get the error "Cannot find variable 'm_domainTable'" for this code
var cookieJar = new CookieContainer();
cookieJar.Add(new Uri("http://someuri.com"), new Cookie("name", "value", "/path/", ".domain"));
var table = (Hashtable) cookieJar.GetType().InvokeMember("m_domainTable",
BindingFlags.NonPublic |
BindingFlags.GetField |
BindingFlags.Instance,
null,
cookieJar,
new object[] {});
The purpose of even using this hack is to be able to cycle through a locally stored cookie file. I tried creating a new project using this code suggested below but I get the error "Object not set to an instance of an Object".
var cookieJar = new CookieContainer();
var table = (Hashtable)cookieJar.GetType()
.GetField("m_domainTable", BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(cookieJar);
So I am stuck. Previously I had shown my SendPost() method but since this error only involves these bits of code I took out that method. If you need any more code or need me to test anything let me know as I would love to get this working.
My enviornment setup is MonoDevelop using Mono / .Net 4.5 using these assemblies:
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Collections;
using System.Web;