Callaspxpagewithdotnet

zhaozj2021-02-16  92

// preparation request ... HttpWebRequest myRequest = (HttpWebRequest) WebRequest.Create (strUrl); myRequest.Method = "POST"; myRequest.ContentType = "application / x-www-form-urlencoded"; myRequest.ContentLength = data. Length; stream newstream = myRequest.getRequestStream (); // Send Data NEWSTREAM.WRITE (DATA, 0, DATA.LENGTH); newstream.close ();

// got the answer. HttpWebResponse httpwresp = (httpwebresponse) MyRequest.getResponse ();

Stream myStream = HttpWResp.GetResponseStream (); // using the default encoding to get the result StreamReader sr = new StreamReader (myStream, Encoding.Default);. StringBuilder strBuilder = new StringBuilder ();! While (-1 = sr.Peek ()) {Str.readLine () "/ r / n");} string strresult = strbuilder.tostring (); if (strresult == "100 / r / n" && a_strflag == "1 ") This.cancellationsteps (A_STRPHONENO, A_STRSERVICE, A_STRMSG," 0 "," 0 "," 2 "); Return 0;

ASPX Page Content

Private void page_load (object sender, system.eventargs e) {// Place user code here to initialize page if (! this.ispostback) {string strfriendid = this.request.QueryString ["FriendID"]. TOSTRING (); String strresult = ""; businessrule br = new businessrule (); br.addfriend (this.session ["username"]. Tostring (), strfriendid; content objco = br.Getfrienlist (this.Session ["username"]. TOSTRING ()); strresult = objco.msgcontent; response.write (strresult);}}

转载请注明原文地址:https://www.9cbs.com/read-13604.html

New Post(0)