Home>

I'm new to C #. I'm trying to make a very simple HTTP communication sample, and I'm stumbling on the first step, and I'd appreciate it if you could help.
As shown in the attached image, I get an error if WebRequest and WebResponse are not found in the System.Net namespace. What should I do?
I added System.Net in the project's reference settings, but according to the content of the error message, this doesn't seem to be the case.

I looked it up on the internet, but I didn't understand it well, so I would appreciate it if you could give me some advice.
The environment is "Visual Studio 2019 Version 16.8.2" ".NET Framework 4.7.2".

  • Answer # 1

    I will post the content of your comment here.

    It seems that an error occurred because it was created with "empty project", and when I created the project with "console app", no error occurred.
    Also, it seems that Microsoft does not recommend using WebRequest for new development, and I received information that it seems better to use HttpClient.