C
C#7mo ago
Memsworth

FluentValidation isn't being used in Razor Page's Model State?

Hello C#. Hope things are good. I confused as to how to let users see the validation errors. I have followed https://docs.fluentvalidation.net/en/latest/aspnet.html 's manual validation method (the recommended for now) to validate the model state. It states I need to write the validator -> inject it to DI -> validate in my RazorPage (cshtml.cs) by adding the validationErrors to the model state. Here's how I wrote my validator: https://pastebin.com/7ckkZFsK Here's how I wrote my form : https://pastebin.com/315cqVff Here's how I wrote my cshtml.cs : https://pastebin.com/q6cQk7qM Is it a fault of FluentValidation? Since I followed how the documentation states to write. Or am I doing something wrong here?
No description
No description
1 Reply
col_rod
col_rod7mo ago
Hello! I hope you found the answer already but if not did you add the following code in program.cs ? services.AddScoped<IValidator<UserRegistrationRequest>, UserRegistrationValidation>();
Want results from more Discord servers?
Add your server