VB.Net HttpWebRequest-将Cookie从HttpWebRequest传输到WebBrowser
我想将cookies从HttpWebRequest传输到WebBrowser。 我尝试了下面的代码,但没有工作 HttpWebRequest中的我的cookie名为:loginPostcookie 我是否将InternetSetCookieEx的参数设置得很好VB.Net HttpWebRequest-将Cookie从HttpWebRequest传输到WebBrowser,vb.net,Vb.net,我想将cookies从HttpWebRequest传输到WebBrowser。 我尝试了下面的代码,但没有工作 HttpWebRequest中的我的cookie名为:loginPostcookie 我是否将InternetSetCookieEx的参数设置得很好 _ 作为布尔值的公共共享函数InternetSetCookieEx(url作为字符串,cookieName作为字符串,cookieData作为StringBuilder,dwFlags作为Int32,lpReserved作为IntPtr
_
作为布尔值的公共共享函数InternetSetCookieEx(url作为字符串,cookieName作为字符串,cookieData作为StringBuilder,dwFlags作为Int32,lpReserved作为IntPtr)
端函数
InternetSetCookieEx(“https://www.facebook.com/,loginPostcookie.ToString,“TestData=Test;”,0,0)
Me.WebBrowser1.导航(“https://www.facebook.com/")
我使用cookie允许我的用户将用户名保存在cookie中,这样他们就不必在登录时一直键入用户名。我使用下面的代码设置并检索cookie“
当用户访问登录页面时,我检查cookie:
' If the signin cookie exists, get the username and check the checkbox
If Not IsNothing(Request.Cookies("SignIn")) Then
If txtUserName.Text & "" = "" Then
txtUserName.Text = Request.Cookies("SignIn").Value
CheckBox_SaveUserName.Checked = True
End If
End If
看看这个:
' If the signin cookie exists, get the username and check the checkbox
If Not IsNothing(Request.Cookies("SignIn")) Then
If txtUserName.Text & "" = "" Then
txtUserName.Text = Request.Cookies("SignIn").Value
CheckBox_SaveUserName.Checked = True
End If
End If