Try this...
Code:
HttpWebRequest req=WebRequest.Create(url_to_send);
req.Method="POST";
req.ContentType = "application/x-www-form-urlencoded";
StringBuilder prepared_string = new StringBuilder();
string_to_send="username="+Username+"&password="+Password;
Char[] reserved = {'?', '=', '&'};
byte[] bytes_to_send = null;
int i=0, j;
while(i<string_to_send.Length)
{
j=string_to_send.IndexOfAny(reserved, i);
if (j==-1)
{
prepared_string.Append(HttpUtility.UrlEncode(string_to_send.Substring(i, string_to_send.Length-i)));
break;
}
prepared_string.Append(HttpUtility.UrlEncode(string_to_send.Substring(i, j-i)));
prepared_string.Append(string_to_send.Substring(j,1));
i = j+1;
}
bytes_to_send = Encoding.UTF8.GetBytes(prepared_string.ToString());
req.ContentLength = bytes_to_send.Length;
WebResponse wresp=req.GetResponse();
Stream strim=wresp.GetResponseStream();
StreamReader sr=new StreamReader(strim);
string line;
while ((line=sr.ReadLine())!=null)
{
//processing line variable
}
strim.Close();
...but the Soon is eclipsed by the Moon