C
Chris Fink
How do I retrieve the HTTP Status code (ie 202, 404, etc) below? I am
currently receiving the response text but unable to access the response
status code.
string strNewValue;
string strResponse;
// Create the request obj
HttpWebRequest req = (HttpWebRequest) WebRequest.Create(txtURL.Text);
// Set values for the request back
req.Method = "POST";
//req.ContentType = "application/x-www-form-urlencoded";
strNewValue = Server.HtmlDecode(txtRequest.Value.ToString());
//req.ContentLength = strNewValue.Length;
req.
// Write the request
StreamWriter stOut = new StreamWriter (req.GetRequestStream(),
System.Text.Encoding.ASCII);
stOut.Write(strNewValue);
stOut.Close();
// Do the request to get the response
StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());
strResponse = stIn.ReadToEnd();
stIn.Close();
txtResponse.Value = strResponse;
currently receiving the response text but unable to access the response
status code.
string strNewValue;
string strResponse;
// Create the request obj
HttpWebRequest req = (HttpWebRequest) WebRequest.Create(txtURL.Text);
// Set values for the request back
req.Method = "POST";
//req.ContentType = "application/x-www-form-urlencoded";
strNewValue = Server.HtmlDecode(txtRequest.Value.ToString());
//req.ContentLength = strNewValue.Length;
req.
// Write the request
StreamWriter stOut = new StreamWriter (req.GetRequestStream(),
System.Text.Encoding.ASCII);
stOut.Write(strNewValue);
stOut.Close();
// Do the request to get the response
StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());
strResponse = stIn.ReadToEnd();
stIn.Close();
txtResponse.Value = strResponse;