Body request
hey there, I'm trying to get the body with this method
but when i will go to see the parameters, don't contain the body and I'm using HttpRequest to do this, exist another way to do this?
12 Replies
What ASP version?
Can't remember the last time I had to rawdog a request like that instead of using parameter binding
And how works parameter bind?
Im a new developer with c#
The entire context is authentication with HMAC
Idk but I will see for you
But my .net version is 8, idk if is the same thing
Example of parameter binding
.NET 8 is the most recent one
So there should be zero issues using plain ol' parameter binding instead of whatever it is you're trying to do
I will try to do this, ty
doesnt this require a [FromBody]?
:lurk:
If you want to be explicit, yeah. But for a post method the default binding is from body.
How can I read the path, body and possible url parameters :thinker:
Like all in 1 function
Is there an attribute for url params?
Well, the path is what you say it's gonna be
Url params can be a part of the path and either bound with
[FromParams]
or just left loose:soPortuguese:
I love ASP.NET
Query string params you can bind with
[From Query]
, which is also a default binding for anything that's unbound
Types on path
Didn't know that worked
You get your data in the
data
the id
param has the value of 69, and the bunga
has the value of "scunga"
Not entirely intuitive, alas. For example, there's no string
, just alpha
for example.