ASP MVC: Custom Validation Attribute

前端 未结 7 917
说谎
说谎 2021-01-18 10:00

I\'m trying to write my own Custom Validation attribute but I\'m having some problems.

The attribute I\'m trying to write is that when a user logs in, the password w

7条回答
  •  鱼传尺愫
    2021-01-18 10:17

    You can't pass a reference type to an attribute unless you do some rather lame reflection code.

    In this situation, I would think creating a custom model binder would be a better idea and then checking the Password and ComparePassword at that point.

提交回复
热议问题