Код: Выделить всё
private Uri currentUri;
private void Form1_Load(object sender, EventArgs e)
{
currentUri = new Uri(@"http://www.stackoverflow.com");
HttpWebRequest myRequest = (HttpWebRequest) HttpWebRequest.Create("http://www.stackoverflow.com");
WebProxy myProxy = new WebProxy("120.198.230.8:81");
myRequest.Proxy = myProxy;
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
webBrowser1.DocumentStream = myResponse.GetResponseStream();
webBrowser1.Navigating += new WebBrowserNavigatingEventHandler(webBrowser1_Navigating);
}
void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
if (e.Url.AbsolutePath != "blank")
{
currentUri = new Uri(currentUri, e.Url.AbsolutePath);
HttpWebRequest myRequest = (HttpWebRequest)HttpWebRequest.Create(currentUri);
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
webBrowser1.DocumentStream = myResponse.GetResponseStream();
e.Cancel = true;
}
}
ошибка: необработанное исключение типа «System. В System.dll произошло Net.WebException'
Дополнительная информация: Базовое соединение было закрыто:
произошла непредвиденная ошибка при получении.< /p>
в строке HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
Пожалуйста, помогите мне.
Подробнее здесь: https://stackoverflow.com/questions/217 ... n-a-receiv