1

I can able to find lot of related answers to trim extra spaces in model input in ASP.NET MVC API.

Referred below links,

  1. How to trim spaces of model in ASP.NET MVC Web API

  2. Best way to trim strings after data entry. Should I create a custom model binder?

Posts are says that by implementing the IModelBinder method below we can achieve string values trim.

bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext);

But the answers provided in the above links are with below signature.

object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)

And I hope this is for MVC. Its not working for me in WEB API.

Any thoughts on this?

Liam
  • 27,717
  • 28
  • 128
  • 190
Magendran V
  • 1,411
  • 3
  • 19
  • 33

0 Answers0