我在 Visual Studio 2013 中使用 C#,使用 geckofx 浏览器,我需要使用 POST 进行导航。Navigate 方法告诉我我需要一个 MimeInputStream,它使用起来很直观。我面临的问题是如何初始化它?MimeInputStream 没有构造函数。我发现下面的代码可以编译,除了它不能像这样将 GeckoMIMEInputStream 转换为 MimeInputStream 的部分。我的代码是:
string dataString = string.Format("username={0}&pwd={1}, Username, Password);
GeckoMIMEInputStream postData = new GeckoMIMEInputStream();
postData.AddHeader("Content-Type", "application/x-www-form-urlencoded");
postData.AddContentLength = true;
postData.SetData(dataString);
myGeckoFXBrowser.Navigate("javascript:void(document.getElementById('formname').submit())", GeckoLoadFlags.ReplaceHistory, null, postData);