To obtain data from an ashx page, use the following methods:
1.
CopyCodeThe Code is as follows: WebClient WC = new WebClient ();
Byte [] pagedata = WC. downloaddata ("http://xxxx.com ");
Hd_num.value = encoding. Default. getstring (pagedata );
Front-end code: <asp: hiddenfield id = "hd_num" runat = "server"/>
Then obtain the value of hd_num through Js.
2.Copy codeThe Code is as follows: httpwebrequest request = httpwebrequest. Create ("http: // xxx/AAA. ashx") as httpwebrequest;
Httpwebresponse response = request. getresponse () as httpwebresponse;
Stream resstream = response. getresponsestream ();
Streamreader sr = new streamreader (resstream, system. Text. encoding. Default); // The encoding can be changed to another
Contenthtml. Text = Sr. readtoend ();
3.
You can also use Ajax cross-origin requests. This part is still being studied.
The data that has been processed is transmitted from my ashx page.