-2

I want to pass very long string as parameter in Asp .net core web api POST method, but when I am passing that it takes only starting few words. How to resolve this issue?

The data I'm passing:

{
"Stack":"  RtrnAddr            Arg#1             Arg#2             Arg#3             Arg#4               Function or address
  -----------------   ----------------- ----------------- ----------------- -----------------   -------------------------------------------------------------------
  00000000`378265ef0 : 00000000`00000001 00000000`38e97628 00000000`1efb5b50 00000000`00000000 
  00000000`0058000001 : 00000000`38e97628 00000000`1efb5b50 00000000`00000000 000007fe`ed12964e 
  00000000`38e987628 : 00000000`1efb5b50 00000000`00000000 000007fe`ed12964e ffffffff`fffffffe 
  00000000`1efb58b50 : 00000000`00000000 000007fe`ed12964e ffffffff`fffffffe 00000000`0028d830 
  00000000`000000000 : 000007fe`ed12964e ffffffff`fffffffe 00000000`0028d830 00000000`001e0644 
"
}
Hille
  • 2,123
  • 22
  • 39

2 Answers2

0

Did you add the [FromBody] attribute to the parameter in the api method?

ex: [FromBody] string value

Please see the below link. It may be useful.

https://www.codeproject.com/Tips/734080/How-to-Pass-a-Large-String-to-a-Web-API-Method-A-2

0
Data you are passing has no issue. It is working. Try this please.

Create another class like this.

public class StackData
    {
        public string Stack{ get; set; }
}

Then use that class with the parameter in api method as below.

public async Task<IActionResult> Post([FromBody] StackData Stack)