私はこのコードを持っています
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim logincookie As New CookieContainer
Dim postData As String = "continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26feature%3Dheader%26nomobiletemp%3D1%26hl%3Den_US%26next%3D%252F&service=youtube&uilel=3&dsh=-5804339713411277263<mpl=sso&hl=en_US&GALX=kpcgpuXEK94&pstMsg=1&dnConn=&checkConnection=youtube%3A4148%3A1&checkedDomains=youtube&timeStmp=&secTok=&Email=" & user_fb.Text & "&Passwd=" & pass_fb.Text & "&signIn=Sign+in&PersistentCookie=yes&rmShown=1"
Dim tempCookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://accounts.google.com/ServiceLoginAuth"), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = tempCookies
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "https://accounts.google.com/ServiceLoginAuth"
postReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko)"
postReq.ContentLength = byteData.Length
Dim postreqstream As Stream = postReq.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
Dim postresponse As HttpWebResponse
logincookie = tempCookies
postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
tempCookies.Add(postresponse.Cookies)
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
WebBrowser1.DocumentText = thepage
End Sub
YouTube に動画をアップロードするためのツールを作成しようとしていますが、サインインしようとすると Cookie に問題があるようです。
このアクションを実行するには Cookie を許可する必要があると書かれています。どうすればクッキーを有効にできますか?