国产探花免费观看_亚洲丰满少妇自慰呻吟_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收集整理,歡迎訪問。
  • 發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 靖远县| 响水县| 隆昌县| 泰兴市| 北宁市| 临湘市| 略阳县| 阳泉市| 镇原县| 隆尧县| 三明市| 揭阳市| 鄂尔多斯市| 青冈县| 湟源县| 池州市| 靖宇县| 雅江县| 长顺县| 黄梅县| 平利县| 花莲县| 沙河市| 西贡区| 江西省| 乐山市| 霍邱县| 阜新| 伊宁市| 庆阳市| 山西省| 朝阳区| 六枝特区| 东乌珠穆沁旗| 曲水县| 新昌县| 阜城县| 那坡县| 浦江县| 尉氏县| 嘉义县|