华为nvr800登录接口调用

var handler = new HttpClientHandler()
{
Credentials = new NetworkCredential("用户名", "密码"),

ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
};
var httpClient = new HttpClient(handler);

var response = await httpClient.PostAsync("nvr的ip/API/Web/Login", null);
var message = response.EnsureSuccessStatusCode();
if (message.IsSuccessStatusCode)
{
var headers = response.Headers;
var session = headers.First(x => x.Key == "Set-Cookie");
var token = headers.First(x => x.Key == "X-csrftoken");
var result=await response.Content.ReadAsStringAsync();
}

  

posted @ 2024-07-31 16:10  红鲤鱼与驴与绿鲤鱼  阅读(17)  评论(0编辑  收藏  举报