C# 如何在Awesomium中创建所有cookie?(包括Http)
我正在使用Awesomium.NETAPI,使用用户在文本框中提供的用户名和密码登录。我的问题是,要发送进一步的请求,例如导航到房间-Habbo是一个通过Http的在线游戏,我需要发送相同的cookies,否则它不起作用 我正在尝试使用以下代码发送导航请求:C# 如何在Awesomium中创建所有cookie?(包括Http),c#,C#,我正在使用Awesomium.NETAPI,使用用户在文本框中提供的用户名和密码登录。我的问题是,要发送进一步的请求,例如导航到房间-Habbo是一个通过Http的在线游戏,我需要发送相同的cookies,否则它不起作用 我正在尝试使用以下代码发送导航请求: using (WebClient WC = new WebClient()) { WC.Headers["X-App-Key"] = Token; WC
using (WebClient WC = new WebClient())
{
WC.Headers["X-App-Key"] = Token;
WC.DownloadString(new Uri(string.Format("http://www.habbo.com/components/roomNavigation?targetId={0}&roomType=private&move=true", roomID)));
}
public int Timer = 0;
public void AttemptLogin_Tick(object sender, EventArgs e)
{
Timer++;
if (Timer == 1)
{
webControl1.Source = new Uri("http://www.habbo.com/client");
}
if (Timer == 3)
{
webControl1.Source = new Uri(string.Format("https://www.habbo.com/account/submit?credentials.username={0}&credentials.password={1}", username2, password2));
}
if(Timer == 6)
{
webControl1.Source = new Uri("http://www.habbo.com/client");
}
}
我需要将Http cookies连接到WC,以便它能够成功。我正在使用以下代码登录:
using (WebClient WC = new WebClient())
{
WC.Headers["X-App-Key"] = Token;
WC.DownloadString(new Uri(string.Format("http://www.habbo.com/components/roomNavigation?targetId={0}&roomType=private&move=true", roomID)));
}
public int Timer = 0;
public void AttemptLogin_Tick(object sender, EventArgs e)
{
Timer++;
if (Timer == 1)
{
webControl1.Source = new Uri("http://www.habbo.com/client");
}
if (Timer == 3)
{
webControl1.Source = new Uri(string.Format("https://www.habbo.com/account/submit?credentials.username={0}&credentials.password={1}", username2, password2));
}
if(Timer == 6)
{
webControl1.Source = new Uri("http://www.habbo.com/client");
}
}
我知道我可以用它来做一些饼干
webControl1.ExecuteJavascriptWithResult("document.cookie;");
但这并没有得到我需要的Http。cookies对于每个会话都是唯一的,因此据我所知,使用HttpWebRequest获取cookies会导致与我需要的不同的Http cookies,因此如果我尝试发送它们,则会将我注销,因为这表明我登录了两个会话
有人有什么想法吗?谢谢。我想你指的是http头。Http本身不使用cookies,它只是提供了一种传输cookies的方法。对不起!谢谢你的澄清,小甜饼很好吃