S
shankararaman.s
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.HttpWebRequest request,request1;
System.Net.HttpWebResponse response,response1;
StreamReader sr;StreamWriter sw;
request1 = (System.Net.HttpWebRequest)
System.Net.WebRequest.Create("http://groups.yahoo.com/");
response1 = (System.Net.HttpWebResponse) request1.GetResponse();
string postData = "login=shansulak_2001&passwd=shansulak";
request =
(HttpWebRequest)System.Net.HttpWebRequest.Create("http://login.yahoo.com/config/login?.intl=us&.src=ygrp&.done=http://groups.yahoo.com");
request.Method = "POST";
request.AllowAutoRedirect = true;
request.ContentType = "application/x-www-form-urlencoded";
Encoding utf8 = new UTF8Encoding();
byte[] content = utf8.GetBytes(postData);
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(content, 0, content.Length);
}
response = (HttpWebResponse)request.GetResponse();
sr = new StreamReader(response.GetResponseStream());
result = sr.ReadToEnd();
sr.Close();
Response.Write(result);
Thanks in advance for your help.
Regards,
Shankara.
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.HttpWebRequest request,request1;
System.Net.HttpWebResponse response,response1;
StreamReader sr;StreamWriter sw;
request1 = (System.Net.HttpWebRequest)
System.Net.WebRequest.Create("http://groups.yahoo.com/");
response1 = (System.Net.HttpWebResponse) request1.GetResponse();
string postData = "login=shansulak_2001&passwd=shansulak";
request =
(HttpWebRequest)System.Net.HttpWebRequest.Create("http://login.yahoo.com/config/login?.intl=us&.src=ygrp&.done=http://groups.yahoo.com");
request.Method = "POST";
request.AllowAutoRedirect = true;
request.ContentType = "application/x-www-form-urlencoded";
Encoding utf8 = new UTF8Encoding();
byte[] content = utf8.GetBytes(postData);
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(content, 0, content.Length);
}
response = (HttpWebResponse)request.GetResponse();
sr = new StreamReader(response.GetResponseStream());
result = sr.ReadToEnd();
sr.Close();
Response.Write(result);
Thanks in advance for your help.
Regards,
Shankara.