0

データを投稿してGmailにログインしようとしています。

これが私のコードです:

     HttpWebRequest hi = (HttpWebRequest)HttpWebRequest.Create("https://www.google.com/accounts/ServiceLoginAuth?service=mail");
     hi.Method = "POST";
     //string PostData = "continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Ftab%3Dwm&service=mail&rm=false&dsh=-28214021908461826&ltmpl=default&scc=1&GALX=6-CDla8snug&pstMsg=1&dnConn=&checkConnection=youtube%3A1271%3A1&checkedDomains=youtube&timeStmp=&secTok=&Email=EMAILADDRESS4u&Passwd=PASSWORD&signIn=Sign+in&rmShown=1";
     hi.ContentType = "application/x-www-form-urlencoded";
     byte[] post = UnicodeEncoding.UTF8.GetBytes(PostData);
     Stream stream = await hi.GetRequestStreamAsync();
     stream.Write(post, 0, PostData.Length);
     WebResponse response = await hi.GetResponseAsync();
     string pageSource;   
     using (StreamReader sr = new StreamReader(response.GetResponseStream()))
     {
         pageSource = sr.ReadToEnd();
     }
     mywebview1.NavigateToString(pageSource);

しかし、これを実行しようとすると、エラーが発生します。この問題を解決するにはどうすればよいですか?

Your browser's cookie functionality is turned off. Please turn it on.
4

1 に答える 1

0

これに関連する質問がすでに 1 つあります...

見てください..

WebBrowser で WebRequest Cookie を使用する

WebBrowser で CookieContainer の Cookie を使用する

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/00a29544-8cf4-4de2-8e7c-e7931b0e2221

于 2012-09-19T06:17:41.987 に答える