How to use WebClient to retrieve URL using WinForms in C#

1 Answer

0 votes
using System.Net;

namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            using (WebClient wc = new WebClient())
            {
                var result = wc.DownloadString("https://seek4info.com");
                
                MessageBox.Show(result);

            }
        }
    }
}




/*
run:

<!DOCTYPE html>\n<html>\n\n<head>\n\t<title>Welcome to Seek4info</title>\n\n\t<meta name=...
  
*/

 



answered Mar 8, 2024 by avibootz
...