HTML Downloader 1.0

Using the Visual Studio integrated development environment and the C# programming language, we will develop a universal application to download the HTML content of a web page.

circle-info

Information

HTML is the standard markup language for describing and designing web pages. HTML is a standard on the Internet and its rules are defined by the World Wide Web Consortium (W3C).

Start

  1. Launch the Visual Studio integrated development environment.

  2. Create a new project: Visual C# > Windows Universal > Blank App (Universal Windows).

  3. Name the project: HTML Downloader 1.0.

From the Project > Manage NuGet Packages menu, search for and install the AngleSharp package, as shown in the figure:

Fig. 40. Installing an additional package to the project

You can also install additional packages for the project alternatively from: Tools > NuGet Package Manager > Package Manager Console, by running the following command in the console:

MainPage.xaml

The MainPage.xaml file contains the source code for the application's user interface design and is written in XAML. Copy (Ctrl+C) and paste (Ctrl+V) the program fragment below into your application.

View of the user interface design (XAML) in Visual Studio while developing the application:

Fig. 1.41. View of the user interface design

MainPage.xaml.cs

The MainPage.xaml.cs file contains the source code for the application's business logic and is written in C#. Copy (Ctrl+C) and paste (Ctrl+V) the program fragment below into your application.

Demo

View of the business logic (C#) in Visual Studio while developing the application:

Fig. 1.42. View of the application's business logic

Run the application from the menu: Debug > Start Debugging or by pressing the F5 key.

Fig. 1.43 Universal application for downloading the HTML content of a web page

Last updated