Hi,
I am trying to develop an interface which will fetch all my Yahoo
mails. I am not able to sign in to yahoo by posting the form with my
username & password. Please find my code below and correct me where am
going wrong.
string result;
System.Net.Http WebRequest request,request 1;
System.Net.Http WebResponse response,respon se1;
StreamReader sr;StreamWriter sw;
request1 = (System.Net.Htt pWebRequest)
System.Net.WebR equest.Create(" http://groups.yahoo.co m/");
response1 = (System.Net.Htt pWebResponse) request1.GetRes ponse();
string postData = "login=shansula k_2001&passwd=s hansulak";
request =
(HttpWebRequest )System.Net.Htt pWebRequest.Cre ate("http://login.yahoo.com/config/login?.intl=us& .src=ygrp&.done =http://groups.yahoo.co m");
request.Method = "POST";
request.AllowAu toRedirect = true;
request.Content Type = "applicatio n/x-www-form-urlencoded";
Encoding utf8 = new UTF8Encoding();
byte[] content = utf8.GetBytes(p ostData);
using (Stream requestStream = request.GetRequ estStream())
{
requestStream.W rite(content, 0, content.Length) ;
}
response = (HttpWebRespons e)request.GetRe sponse();
sr = new StreamReader(re sponse.GetRespo nseStream());
result = sr.ReadToEnd();
sr.Close();
Response.Write( result);
Thanks in advance for your help.
Regards,
Shankara.
Comment