XSRF-Token

DataKnight11

Member
Joined
Apr 18, 2024
Messages
18
Location
Portugal
Programming Experience
Beginner
Hello community,

How is it possible to make http request for login in C#?
When I try to make the http request with the POST protocol I cannot obtain the XSRF-TOKEN.
Can anyone help me?



var loginData = new { userName = username, systemCode = password };
var requestBody = new StringContent(JsonConvert.SerializeObject(loginData), Encoding.UTF8, "application/json");



HttpResponseMessage response = await _httpClient.PostAsync(url, requestBody);
Console.WriteLine($"Status Code: {response.StatusCode}");
LogResponseDetails(response);
 
Nice!
 
Looking at post #3, it looks like you tried that and didn't get the expected results. Oh well, still glad that you got it working.
 
Back
Top Bottom