Dear,
I would like a query on a internal network tool about a internal url like "http://192.168.1.10:5000" and write the result in a RichTextBox or write it in a text-file.
I have mak a sample, but it does not run.
I get in the sample an exeption on line 26. "WebResponse response = request.GetResponse();"
I don't no where ist the problem?
Please, could help me anyone?
I have a form with
- textBox1.Text = http://192.168.1.10:5000
- richTextBox
and a button
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Net;
- using System.IO;
-
- namespace Http_Webabfrage_1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- string URL = textBox1.Text;
- WebRequest request = WebRequest.Create(URL);
- WebResponse response = request.GetResponse();
- StreamReader reader = new StreamReader(response.GetResponseStream());
- string str = reader.ReadLine();
- while (str != null)
- {
- richTextBox1.Text = str;
- }
- }
- }
- }