简体   繁体   English

如何为ASP.NET Core 1实现模型绑定器以修剪表单输入空间

[英]How to implement model binder for ASP.NET Core 1 to trim form input spaces

I want to trim the spaces from the form inputs. 我想修剪表单输入中的空格。 I realized that this is possible through custom model binder. 我意识到通过自定义模型活页夹可以做到这一点。 I want to do that for ASP.NET Core 1.0 MVC6. 我想为ASP.NET Core 1.0 MVC6做到这一点。 I found and example http://www.hotzblog.com/asp-net-vnext-defaultmodelbinder-and-automatic-viewmodel-string-trim/ but it is for release candidate. 我找到了一个示例http://www.hotzblog.com/asp-net-vnext-defaultmodelbinder-and-automatic-viewmodel-string-trim/,但这是发布候选版本。

Please, can you help with giving me an example how to implement such model binder. 请,您能帮我举例说明如何实现这种模型绑定程序吗?

作为该文章的作者,我想告诉您,它现已更新为支持ASP.NET core 1.0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM