AhmedAzizBarbary
Programmer
I work on asp.net razor page Login user name and password . I call Web API validate user
name and password . my issue I face it I can't receive data returned after login success
JSON data returned from web API after success login username and password
I call api from razor page login as below :
I need to return data from login success where message=success as logic below :
image below explain what i need to do exactly
image show data I need to receive
name and password . my issue I face it I can't receive data returned after login success
JSON data returned from web API after success login username and password
Code:
{
"message": "success",
"status": true,
"data": {
"userID": "9595",
"userName": "ADC Test User",
"userRole": "Administrator",
"environment": "PY"
},
"statusCode": "0000"
}
Code:
public async Task OnPost()
{
UserLoginViewModel loginview = new UserLoginViewModel();
loginview.UserID = User.UserName;
loginview.Password = User.vPassword;
var json = JsonSerializer.Serialize(loginview);
var content = new StringContent(json, Encoding.UTF8, "application/json");
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "[URL unfurl="true"]https://localhost:44374/api/adcxx/ValidateUser");[/URL]
request.Content = content;
var response = await _httpClient.SendAsync(request);
if (response.IsSuccessStatusCode)
{
}
}
Code:
if (response.IsSuccessStatusCode)
{
IF(message=="success" AND status="true")
{
receive `user id and username and user role and password`
}
}
image show data I need to receive