如何通过IP地址来webBrowser控件 [英] how to pass ip-address to webBrowser control

查看:230
本文介绍了如何通过IP地址来webBrowser控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过ip地址为web浏览器控件

这是我的code,但我不知道如何通过IP地址来WebBrowser控件。

  IPHostEntry主机;
字符串localIP =?;
主机= Dns.GetHostEntry(Dns.GetHostName());
的foreach(在File.ReadAllLines串行(proxy.txt))
{
    的IPAddress的ip = IPAddress.Parse(线);
    如果(ip.AddressFamily.ToString()==网间)
    {
        localIP = ip.ToString();
        textBox1.Text = ip.ToString();

        //这个code不起作用,它只是一个假设的例子:
        webBrowser1.SourceIPAddress = IP;

        WebBrowser1.Navigate时(textBox2.Text);
    }
}
 

这是我想通过IP地址来webBrowser控件

  //将code不起作用,它只是一个假设的例子:
webBrowser1.SourceIPAddress = IP;
 

解决方案

只是写在文本 http://74.125.236.211

  textBox2.Text =htt​​p://74.125.236.211
 

How to pass IPAddress to webBrowser control

This is my code but i don't know how to pass ip-address to webBrowser control.

IPHostEntry host;
string localIP = "?";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (string line in File.ReadAllLines("proxy.txt"))
{
    IPAddress ip = IPAddress.Parse(line);
    if (ip.AddressFamily.ToString() == "InterNetwork")
    {
        localIP = ip.ToString();
        textBox1.Text = ip.ToString();

        // This code doesn't work, it's just a hypothetical example:
        webBrowser1.SourceIPAddress=ip; 

        webBrowser1.Navigate(textBox2.Text);
    }
}

this is how i want to pass ip-address to webBrowser control

//The code doesn't work, it's just a hypothetical example:
webBrowser1.SourceIPAddress = ip;

解决方案

Just Write in your textbox http://74.125.236.211

or

textBox2.Text="http://74.125.236.211"

这篇关于如何通过IP地址来webBrowser控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆