Next, I have a code that reads a particular web page:
private string GetCodePage()
{
WebRequest request = WebRequest.Create(URL);
WebResponse response = request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
var codePage = reader.ReadToEnd();
reader.Close();
response.Close();
return codePage;
}
I'm trying to make the same code with .NET Core, but the classes have changed, for example, the WebRequest.GetResponse
method no longer exists.
Does anyone know how to read html pages through DotNet Core?