问题
I am trying to exclude some properties from binding when getting values from View I am using at the action level : Bind exclude as the following :
I need this property to sent to the view (as readonly) but not allowing the user to update the value or even hacker try to inject value .... the question:is exclude no longer available in ASP MVC Core ? is there any other way ? again I know I can exclude the Property at Model level (using neverbind) but I want only send the value to the view , but not receive them back !
回答1:
There are some discussion in : https://github.com/aspnet/AspNetCore/issues/4857 :
Yup. I wanted a strict binder where you had to specify everything, but apparently this was too mean. Of course really everything should be view model based.
How would you feel about throwing if someone bound to a class used in a dbcontext?
So currently you may need to use include for security concern .
来源:https://stackoverflow.com/questions/55665609/is-bindexclude-removed-from-asp-core