---
title: "跨越代理取得uri数据的方法[C#]"
author: "DJ阿布"
date: "2011-08-29T16:20:54Z"
tags: []
categories: ["编程语言"]
slug: "uri-c"
draft: false
lastmod: "2011-08-29T16:20:54Z"
id: 1160592
url: "https://itchen.iteye.com/blog/1160592"
---

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create([http://hq.sinajs.cn/list=sh000001](http://hq.sinajs.cn/list=sh000001));  
            WebProxy myProxy = new WebProxy();  
            myProxy.Address = new Uri("[http://proxy:port](http://proxy:port)");  
            myProxy.Credentials = new NetworkCredential("username", "password");  
            request.Proxy = myProxy;

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();  
            Stream respStream = response.GetResponseStream();  
            StreamReader reader = new StreamReader(respStream);  
            string line = reader.ReadLine();