Запрос WebBroswer в Windows Phone
У меня есть следующий код, но при его сборке я получаю сообщение об ошибке в WebBrowserDocumentCompletedEventArgs, сообщающее, что тип или пространство имен не может быть найдено.
Я искал в Интернете и пытался добавить DLL более часа. Кто-нибудь может помочь?
private void b_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser b = sender as WebBrowser;
string response = b.DocumentText;
// looks in the page source to find the authenticity token.
// could also use regular exp<b></b>ressions here.
int index = response.IndexOf("authenticity_token");
int startIndex = index + 41;
string authenticityToken = response.Substring(startIndex, 40);
// unregisters the first event handler
// adds a second event handler
b.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted2);
// format our data that we are going to post to the server
// this will include our post parameters. They do not need to be in a specific
// order, as long as they are concatenated together using an ampersand ( & )
string postData = string.Format("authenticity_token={2}&session[username_or_email]={0}&session[password]={1}&commit={3}", username, password, authenticityToken, commit);
ASCIIEncoding enc = new ASCIIEncoding();
// we are encoding the postData to a byte array
b.Navigate("https://twitter.com/sessions", "", enc.GetBytes(postData), "Content-Type: application/x-www-form-urlencoded\r\n");
}