How would I connect a UWP to the Internet? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How would I connect a UWP to the Internet?

First of all, how would I make a UWP be able to connect to the Internet using the API? I know that I need `using namespace Windows::Networking::Connectivity` but I'm not sure where to go after that. How do I establish whether there is an Internet connection or not? Secondly, say we have a website `www.sololearn.com` . What method would I use to extract data from it? For example: - A whole web page - Part of a webpage -A line of a webpage - A word of a website - The CSS and JS ?

18th Jun 2018, 5:16 PM
VortexYT
5 Answers
+ 1
depends on what protocol you want to use. do you want to use http, ftp or something else? or do you want to work directly with tcp or udp. for the website you would need an html parser. most common method is to use a html to xhtml cleanup library and then an xml parser or use one of the parsers thats part of the browsers
18th Jun 2018, 5:33 PM
Max
Max - avatar
+ 1
like i said: what protocol do you want to use? do you just want to use http to download websites?
18th Jun 2018, 6:31 PM
Max
Max - avatar
+ 1
have you tried the WebClient class from System.Net ? https://stackoverflow.com/questions/26233/fastest-c-sharp-code-to-download-a-web-page you can also use http/https manually using the HttpClient class if you need finer controll or want to use the http(s) protocol in some other way(like get or post requests)
21st Jun 2018, 4:07 PM
Max
Max - avatar
0
what about my first question?
18th Jun 2018, 6:30 PM
VortexYT
0
https to take data from it
21st Jun 2018, 4:00 PM
VortexYT