Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding Custom Object From Header Asp.Net Core WebApi

How do i bind an object from header. Am using the [FromHeader(Name = "Custom-Object")] but it seems to only be able to bind strings and sting arrays. Do i need to write custom binding or am i missing something here? I wonder why fromheader cannot bind complex object like frombody?

like image 824
flexxxit Avatar asked Mar 31 '17 08:03

flexxxit


1 Answers

Write custom binder by using IModelBinder and IModelBinderProvider that should resolve your problem.

like image 69
Raj kumar Avatar answered Oct 13 '22 12:10

Raj kumar