Trims all model string types after postback to clear out any whitespace at the start or end of fields.
To prevent a field from being trimmed use the [NoTrim] attribute.
builder.Services.AddControllersWithViews(options => { options.ModelBinderProviders.Insert(0, new ShareItModelBinderProvider()); });To also trim Json strings
builder.Services.AddControllersWithViews(options => { options.ModelBinderProviders.Insert(0, new ShareItModelBinderProvider()); }) .AddJsonOptions(opt => { options.JsonSerializerOptions.Converters.Add(new StringTrimmerJsonConverter()); });