1st of all, you have to add a new namespace (using System.Net;)
Now I will show you a simple example of how to get the website`s text:
List<string> list = new List<string>();
private void GetAllText()
WebRequest request = WebRequest.Create("http://www.daniweb.com");
WebResponse response = request.GetResponse();
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
list.Add(sr.ReadLine()); //line by line it writes into a list<T>.
That is an odd example Mitja, you only need 2 lines of code for this, you defiantly don't want to separate all the strings into a generic list like that. And its unnecessary to handle the request and response like that. Just use your framework classes.
// Create web client.
WebClient client = new WebClient();
// Download string.
string value = client.DownloadString("http://www.daniweb.com/");
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...