国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

老外編的程序(二)--System.Net的示例程序

2024-07-10 13:00:28
字體:
來源:轉載
供稿:網友
using system;
using system.net;
using system.text;
using system.collections.specialized;

public class webclientsample
{
    public static void main()
    {
        try {
            
        // download the data to a buffer
               webclient client = new webclient();

          byte[] pagedata = client.downloaddata("http://www.microsoft.com");
        string pagehtml = encoding.ascii.getstring(pagedata);
        console.writeline(pagehtml);

        // download the data to a file
                client.downloadfile("http://www.bn.com", "page.htm");

        // upload some form post values
        namevaluecollection form = new namevaluecollection();        
        form.add("myname", "myvalue");        
        byte[] responsedata = client.uploadvalues("http://localhost/somefile.aspx", form);        

        }
        catch (webexception webex) {
              console.writeline(webex.tostring());
               if(webex.status == webexceptionstatus.connectfailure) {
                   console.writeline("are you behind a firewall?  if so, go through the proxy server.");
               }
        }
    }        
}
  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  • 發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 门头沟区| 确山县| 宁化县| 静海县| 宁阳县| 富锦市| 泸水县| 寻乌县| 库车县| 休宁县| 从化市| 噶尔县| 夏津县| 沅陵县| 岳阳县| 隆安县| 七台河市| 巴林左旗| 东乌| 永寿县| 遂昌县| 万宁市| 崇礼县| 洛阳市| 囊谦县| 太仆寺旗| 扬中市| 尤溪县| 晋城| 黑山县| 新巴尔虎右旗| 漯河市| 顺昌县| 马鞍山市| 沿河| 阳东县| 石屏县| 新巴尔虎左旗| 孝昌县| 孝昌县| 舟山市|