简体   繁体   中英

Using an alternative to WebBrowser control

I'm currently using linux so I have problems using WebBrowser control in C#, I run MonoDevelop in Ubuntu 12.04, and apparently the WebBrowser control uses IE, so there's my problem, is there any way of grabbing the HTML from the website using HTTP functions then parse it in the box where I want it?

this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser1.Location = new System.Drawing.Point (0, 0);
this.webBrowser1.MinimumSize = new System.Drawing.Size (20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.Size = new System.Drawing.Size (404, 178);
this.webBrowser1.TabIndex = 0;
this.webBrowser1.Url = new System.Uri ("http://url.net/a.php", System.UriKind.Absolute);

All I really need is a Linux/Unix compatible version of it :) Thanks!

Not mine , you can read the url link

 public static String readWebLink(  String url)
            {
                System.Net.WebClient client = new System.Net.WebClient();
                byte[] data = client.DownloadData(url);
                String html = System.Text.Encoding.UTF8.GetString(data);
                return html;

            }

or

   public static String readWebLink(  String url)
    {
     System.Net.WebClient webclient = new System.Net.WebClient();
     return  webclient.DownloadString(url);
     }

Thankyou

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM