I'm working on an application in C# that checks the status code of the websites so I need to get the status code for each given website.
This is the output of the HTTP status code that I need to get in C#.
First, you need to use System.Net namespace then create a web request to the website
using System.Net; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(“https://debug.to”);
After creating a web request then you need to get the response for that site request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Now you can get the status code for that response
HttpStatusCode statusCode = response.StatusCode; Console.Write(“Status Code: ”+ (int)statusCode + “ ”+ statusCode);
1.1k questions
679 answers
459 comments
193k users
Related Activities
Categories
Most popular tags