what version of the .net framework? your code worked without any packages in a .net 8 console app.
try:
mkdir test
cd test
dotnet new console
edit program.cs then
dotnet run
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
that was my first code:
//using System.Threading.Tasks;
//using System.Net.Http;
//using System;
namespace Program
{
class EmailValidation
{
static async Task Main(string[] args)
{
string request = "https://api.eva.pingutil.com/email?email=";
try
{
HttpClient http = new HttpClient();
Console.Write("Type your email: ");
string email = Console.ReadLine();
request += email;
HttpResponseMessage response = await http.GetAsync(request);
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Response is okay!");
}
else Console.WriteLine("Response isn't okay!");
Console.WriteLine(request);
string output = await response.Content.ReadAsStringAsync();
Console.WriteLine(output);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
};
}
But, i get this error:
Program.cs(2,18): error CS0234: The type or namespace name 'Task' could not be found (are you missing a using directive or an assembly reference?)
If i put the using directives, i get the same error but for "http doesn't exist in namespace System.Net".
How do i fix this?
what version of the .net framework? your code worked without any packages in a .net 8 console app.
try:
mkdir test
cd test
dotnet new console
edit program.cs then
dotnet run