I have a website that has a text file for example http: //site.com/text.txt and I want to use the text from the text file in the lable element so that if necessary I can change this text on the site and the text has changed in the program itself I was looking for information about this but I could not find it; you can translate an example of how it should look in code.

    1 answer 1

    The most trivial option is to download the file, read it, delete the file. There is nothing complicated, so I will not write the code.

    But, there is an option and more interesting:

    var req = (HttpWebRequest)HttpWebRequest.Create(url); using (var resp = req.GetResponse()) { using (var stream = resp.GetResponseStream()) { byte[] buffer = new byte[0x10000]; int len; while ((len = stream.Read(buffer, 0, buffer.Length)) > 0) { // Работаете с данными fileStream.Write(buffer, 0, len); } } }