2025 Nov 06 10:34 AM - edited 2025 Nov 06 2:23 PM
Hi,
I am using SAP B1.Can someone please help me with this, When I am trying to getting the session id from the Postman its giving me success response
But when I am trying to do same thing with .net code its throwing the error
Here is my code snippet as well
string endpoint = $"{baseURL.TrimEnd('/')}/{version.Trim('/')}/Login";
var payload = new
{
CompanyDB = "SBODemoUS",
UserName = "manager",
Password = "xxxxxxx"
};
string jsonContent = JsonConvert.SerializeObject(payload);
var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true
};
var httpclient = new HttpClient(handler);
var content = new StringContent(jsonContent, null, "application/json");
var response = await httpclient.PostAsync(endpoint, content);
if (!response.IsSuccessStatusCode)
{
var responseContent = await response.Content.ReadAsStringAsync();
}
I also overserved that when I am trying to run the same code from .net core its working but when I am trying with .net 4.7 its throwing error.
Request clarification before answering.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.