Httpwebresponse asynchronous: request. begingetrequeststream error! The body of the content with this predicate type cannot be sent.

Source: Internet
Author: User

Request. begingetrequeststream error! The body of the content with this predicate type cannot be sent.

Note This method:

///// Request. method = "get"; // this method is called if it is not asynchronous.

Request. method = "Post"; // this method is called if it is asynchronous.

Try
{
Request = webrequest. Create (string. Format (geturi, weburi, betinfor. Row. playid, uid, ptype, gnum) as httpwebrequest;

///// Request. method = "get"; // this method is called if it is not asynchronous.

Request. method = "Post"; // this method is called if it is asynchronous.
Request. keepalive = true;
Request. Timeout = 400;
If (betinfor. playmode = playmode. Go)
Request. Referer = string. Format ("{0} APP/member/bk_browse/body_browse.php? Uid = {1} & Rtype = Re & langx = ZH-CN & mtype = 3 & delay = ", weburi, UID );
Else if (betinfor. playmode = playmode. Single)
Request. Referer = string. Format ("{0} APP/member/bk_browse/body_browse.php? Uid = {1} & Rtype = R & langx = ZH-CN & mtype = 3 & delay = ", weburi, UID );
Request. useragent = "MSIE 6.0 ";

//************************************** * *** Asynchronous call
Request. begingetrequeststream (New asynccallback (requestcallback), request );
Alldone. waitone ();

Response = (httpwebresponse) request. getresponse ();
Stream = response. getresponsestream ();
Thread. Sleep (1 );
Streamreader streamread = new streamreader (stream, big5 );
Result = streamread. readtoend ();
Stream. Close ();
Streamread. Close ();
//************************************** ********************
///// Response = request. getresponse () as httpwebresponse;
///// Stream = response. getresponsestream ();
///// Streamreader sr = NULL;
///// Sr = new streamreader (stream, big5 );
//// While (COUNT = Sr. Read (leftbuffer, 0, leftbuffer. Length)> 0)
//////{
//// String STR = new string (leftbuffer, 0, count );
///// Leftsb. append (STR );
//////}
//// Sr. Close ();

# Region extract data
//// Result = leftsb. tostring ();
If (result. indexof ("medium ")! =-1 | betinfor. playmode = playmode. Single)
{

}
# Endregion
}
Catch (exception e) {Throw new exception ("exception occurred when obtaining the left side" + Result + E. message + "," + E. targetsite + "," + E. innerexception );}
Finally
{
If (response! = NULL) response. Close ();
If (request! = NULL) request. Abort ();

Leftsb. Remove (0, leftsb. Length );
}
If (! String. isnullorempty (gmin_single) & (INT) (betinfor. odds + 0.0001) * 1000) % 10 = 0) // a ticket with a decimal number of 3rd digits will be canceled
{

}
Else betinfor. Odds = 0;
Time2 = environment. tickcount;
Betinfor. gettime = time2-time1;
Return result;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.