Hi Sandip , I am a new bie in ASP .net i just read through the code and tried to automate my webmail login via same, while i am getting 401 .
Could you please suggest me , where do i need to work on , also any help on other web methods , like i used to work with (web browser control in forms for login automation) would be much helpful.
Thank you
<pre>
Uri uri1=new Uri("https://webmail.abc.com");
string strPostData = String.Format("username={0}&password={1}", "username", "passw123");
HttpWebRequest webreq1=WebRequest.Create(uri1) as HttpWebRequest;
webreq1.Method = "post";
webreq1.ContentLength = strPostData.Length;
webreq1.ContentType = "application/x-www-form-urlencoded";
CookieContainer cookieContainer = new CookieContainer();
webreq1.CookieContainer = cookieContainer;
StreamWriter web1_p = new StreamWriter(webreq1.GetRequestStream());
web1_p.Write(strPostData);
web1_p.Close();
HttpWebResponse Hr_resp = (HttpWebResponse)webreq1.GetResponse();
StreamReader sr_reader = new StreamReader(Hr_resp.GetResponseStream());
string weba = sr_reader.ReadToEnd();
TextBox1.Text = Andz.ToString();
sr_reader.Close();