老外编的程序(二)--System.Net的示例程序
来源:互联网 发布:win8修改mac地址 编辑:程序博客网 时间:2024/06/05 23:29
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
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.");
}
}
} &n
老外编的程序(二)--System.Net的示例程序';return true">
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
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.");
}
}
} &n
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 老外编的程序(二)--System.Net的示例程序
- 老外编的程序(四)--HashTable的使用示例
- 老外编的程序(三)--正则表达式的Demo
- 老外编的程序(五)--如何使用全球标识符(GUID)
- 老外编的程序(九):Using Indexer Properties
- 老外的sms程序
- 老外编的程序(八):在CSharp里面使用Http Get方法
- 一些Linux上编的基础程序(二)字符串
- 编的程序
- 编的小程序
- 转:NET程序的破解(二)
- NET程序的破解(二)
- VB.net 程序的打包问题示例
- 会编程序的猴子
- 编程序的几个良好习惯
- 我编的程序2
- 第一次编程序的感想
- mfc编的计算器程序
- PHP控制语句
- 实现由web.config控制的验证
- PHP的十个高级技巧
- 微软开放.net的部分源代码(c#编译器等)
- PHP 实现多服务器共享 SESSION 数据
- 老外编的程序(二)--System.Net的示例程序
- PHP安全配置2
- Online CPU Console using a Web Control Library wit
- 构架Linux下的PHP+MySQL开发环境
- web组件的通信---浅谈事件
- 带Oracle数据库分页显示功能的留言簿
- 《.net编程先锋C#》第四章 C#类型(转)
- PHP中字体应用释疑
- 图象显示和翻转控件(用户自定义控件)--我也来凑凑热闹--(转)