Har problem med att skicka data till chatten, streamreadern skickar inget,.. (har kollat trafiken)Chat-problem
<code>
private void btnSkicka_Click(object sender, System.EventArgs e)
{
byte[] strInfoA=Encoding.ASCII.GetBytes(txtText.Text);
string strInfo = "text="+Encoding.ASCII.GetString(strInfoA);
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] SomeBytes = encoding.GetBytes(strInfo);
CookieContainer ccKakHållare = new CookieContainer();
ccKakHållare.Add(ccKakor);
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://www.pellesoft.se/login/chat/writemessage.asp?room=1&action=write&large=0"); //http://www.chedhill.com/testcookie.asp"); //http://thomasa88.digitalrice.com/cookieexempel.cgi");
httpWebRequest.CookieContainer = ccKakHållare;
httpWebRequest.ContentLength = SomeBytes.Length;
httpWebRequest.Method="POST";
httpWebRequest.Timeout=10000;
httpWebRequest.AllowWriteStreamBuffering=true;
httpWebRequest.ContentType="application/x-www-form-urlencoded";
//httpWebRequest.Referer="http://www.pellesoft.se";
System.Diagnostics.Debug.WriteLine(strInfo);
StreamWriter myStream = new StreamWriter(httpWebRequest.GetRequestStream(),Encoding.ASCII);
myStream.Write(strInfo); //,0,SomeBytes.Length);
myStream.Close();
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
StreamReader myStreamReader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.Default); //,Encoding.ASCII
MessageBox.Show(myStreamReader.ReadToEnd());
myStreamReader.Close();
httpWebResponse.Close();
}
</code>
//Mr T