我正在使用HttpClient尝试更新数据库,但未更新,但是当我使用控制台应用程序时,它工作正常,请帮助我使用asp.net。这是代码...
var token = Encoding.ASCII.GetBytes(email + ":" + password );
var client = ApiHelper.SendClient();
client.DefaultRequestHeaders.Authorization = new
AuthenticationHeaderValue("Basic",Convert.ToBase64String(token));
var response = client.PutAsJsonAsync("api/UpdateCurrentUser", json ).Result ;
if(response.IsSuccessStatusCode )
{
var res = response.Content.ReadAsStringAsync();
}