上一篇:ASP.NET POST方式提交数据 >>
ASP.NET GET 方式提交数据!
{
Uri uri = new Uri(TheURL);
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri);
string page;
try
{
request.KeepAlive = false;
request.ProtocolVersion=HttpVersion.Version10;
request.Method = "GET";
request.ContentType = "application/x-www-form-urlencoded";
request.Proxy = System.Net.WebProxy.GetDefaultProxy();
//allow auto redirects from redirect headers
request.AllowAutoRedirect=true;
//maximum of 10 auto redirects
request.MaximumAutomaticRedirections=10;
//30 second timeout for request
request.Timeout=(int) new TimeSpan(0,0,60).TotalMilliseconds;
//give the crawler a name.
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
//request.UserAgent="Mozilla/3.0 (compatible; My Browser/1.0)";
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader readStream = new StreamReader (responseStream, System.Text.Encoding.Default);
page = readStream.ReadToEnd();
}
catch (Exception ee)
{
page = "Fail message : "+ee.Message;
}
return page;
}
下一篇:ASP.NET的include的用法 >>
相关文章:
- · ASP.NET中的应用程序配置
- · 基于ASP.NET的网页复用方法
- · 在ASP.NET访问Excel文件
- · Asp.net中DataGrid控件的自定义分页
- · 将ASP.NET Control转换为String
- · 在ASP.NET中杀死进程
- · 在ASP.NET中将数据直接输出成Excel内容
- · 在ASP.NET里轻松实现缩略图
- · 用ASP.NET加密Cookie数据
- · 在ASP.NET中实现多文件上传
- · 在ASP.NET中动态创建柱状图和饼图
- · 利用ASP.NET DataGrid显示主次关系的数据
- · 常用ASP。NET技巧
- · 采用HttpModules来重写URLs(实践篇)
- · 在 ASP.NET 中执行 URL 重写
- · 利用 ASP.NET 2.0 创建自定义 Web 控件
- · ASP.NET应用程序的安全模型
- · DVNEWS 3.2 1013版免虚拟目录的安装方法,只要三个步骤
- · ASP.NET十大技巧
- · 如何更新父窗体
- · 如何在域控制器上安装asp.net?
- · Asp.net动态生成html页面
- · asp.net 2.0中一次性更新所有GRIDVIEW的记录
- · ASP.NET with C#使用md5,sha1加密初探
- · 创建虚拟目录的常用属性
- · asp.net控件加載
- · 在ASP.Net 中使用实现windows登陆的方法
- · 在ASP.NET中动态加载内容(用户控件和模板)
- · ASP.net组件编程中的两种事件编写方法
- · ASP.NET事件小探讨
- · asp.net连接Access数据库
- · [ASP.net(C#)]自定义数据库操作类(一)
- · asp.net 中用户和角色的验证
- · 在.NET中调用Oracle9i存储过程经验总结
- · 枚举类型的用法
- · Tag属性的妙用
- · 怎样得到文本框(TextBox)中的文本行数
- · ASP.NET IIS 注册工具 (Aspnet_regiis.exe)
