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.Crea te(txtURL.Text) ;
// Set values for the request back
req.Method = "POST";
//req.ContentType = "applicatio n/x-www-form-urlencoded";
strNewValue = Server.HtmlDeco de(txtRequest.V alue.ToString() );
//req.ContentLeng th = strNewValue.Len gth;
req.
// Write the request
StreamWriter stOut = new StreamWriter (req.GetRequest Stream(),
System.Text.Enc oding.ASCII);
stOut.Write(str NewValue);
stOut.Close();
// Do the request to get the response
StreamReader stIn = new StreamReader(re q.GetResponse() .GetResponseStr eam());
strResponse = stIn.ReadToEnd( );
stIn.Close();
txtResponse.Val ue = 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.Crea te(txtURL.Text) ;
// Set values for the request back
req.Method = "POST";
//req.ContentType = "applicatio n/x-www-form-urlencoded";
strNewValue = Server.HtmlDeco de(txtRequest.V alue.ToString() );
//req.ContentLeng th = strNewValue.Len gth;
req.
// Write the request
StreamWriter stOut = new StreamWriter (req.GetRequest Stream(),
System.Text.Enc oding.ASCII);
stOut.Write(str NewValue);
stOut.Close();
// Do the request to get the response
StreamReader stIn = new StreamReader(re q.GetResponse() .GetResponseStr eam());
strResponse = stIn.ReadToEnd( );
stIn.Close();
txtResponse.Val ue = strResponse;
Comment