© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
1 reply
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?
image.webp
image.webp
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Debugging razor component page isn`t working
C#CC# / help
3y ago
❔ Razor Pages Session for revalidating Page Model
C#CC# / help
3y ago
Window opacity isn't being affected?
C#CC# / help
4y ago
❔ Page debugging twice in razor pages PageRouteModelConvention
C#CC# / help
4y ago