Get the content obtained by ashx and the data processed by of

  • 2020-05-24 05:28:19
  • OfStack

To get data from 1 ashx page, use the following methods:
1.
 
WebClient wc = new WebClient(); 
Byte[] pageData = wc.DownloadData("http://xxxx.com"); 
hd_num.Value = Encoding.Default.GetString(pageData); 
 Foreground code: <asp:HiddenField ID="hd_num" runat="server" /> 
 through js To obtain hd_num The value of the.  

2.
 
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 code can be changed to something else  
ContentHtml.Text = sr.ReadToEnd(); 

3.
You can also use the cross-domain requests of ajax, which is still under development.
My ashx page is basically the data that has been processed.

Related articles: