注册 | 登录
欢迎注册会员

当前位置:首页 > 365体育官方中文版 > NET技术 > 正文

ASP.NET GET 方式提交数据!

来源:程序人生 【 】 浏览:127 添加日期:2010-05-28 01:55:35 我要评论(0)

 private string RequestGet(string TheURL, string TheProxy)
  {
   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();
365体育官方中文版    StreamReader readStream = new StreamReader (responseStream, System.Text.Encoding.Default);

    page = readStream.ReadToEnd();
   }
   catch (Exception ee)
   {
    page = "Fail message : "+ee.Message;
   }
   return page;

  }


你浏览的文章是 - 《ASP.NET GET 方式提交数据!》!
文章出处:https://www.procedurelife.com/content/ccjkl.html
NET
0% (0)
0% (0)
评论0
游客
1 2