Visual Studioに次のコードがあります
using System;
using System.Windows.Forms;
using System.Net.Http;
using System.Web;
using System.Net;
using System.IO;
namespace Xml_Trial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void LoadUrl_click(object sender, EventArgs e)
{
Xmlcheck(TxtUrl.Text);
}
private static async void Xmlcheck(string TxtUrl)
{
try
{
HttpClient client = new HttpClient() ; //httpclient
var request = new HttpRequestMessage(HttpMethod.Get, TxtUrl);
HttpResponseMessage response = await client.GetAsync(request.RequestUri);
if (response.StatusCode == HttpStatusCode.OK)
{
// Console.WriteLine((int)response.StatusCode); More code here
}
response.Dispose();
}
catch (HttpRequestException e)
{
MessageBox.Show(e.Message);
}
}
}
}
200ステータスコードを取得するために、この方法でコードを書きましたConsole.WriteLine((int)response.StatusCode)
。「OK」または「200」だけでなく、httpstatuscodeの説明からさらに多くのコードを取得するために他に可能なコードは何ですか....