MODEL VALIDATION in ASP.NET Core | Getting Started With ASP.NET Core Series
HTML-код
- Опубликовано: 10 сен 2024
- Hola, Validating user input is an important part of application development. ASP NET Core provides some built-in mechanisms for validating user input.
In this video let's learn more about how to validate user input for Web API Controllers. This is also applicable to Razor Pages app. I will show you how to use ModelState, data annotation attributes, create custom attributes, and also add class level validations for model classes.
Additional Watching
📹Model Binding in ASP NET Core - • MODEL BINDING in ASP.N...
📹ASP NET Core Series - • ASP.NET Core
Come say hi! ✋
🌍 Blog - rahulpnath.com/
✉ Subscribe to my Newsletter - www.rahulpnath...
🐦Twitter - / rahulpnath
📸Instagram - / rahulpnath
🎥 Recording Setup and Workflow - www.rahulpnath...
Make sure to SUBSCRIBE to the channel. THANK YOU for helping me grow this channel !!
You are a sage, a gem 😊
Glad the videos are helping Mukesh! Hope you are liking the Series bit.ly/asp-net-core-series
Another great informative video. We are learning a lot with your help. Thanks a lot Rahul. May God Bless you!
Thanks again Niroshan! Glad you are liking them.
I guess it's kinda off topic but does anybody know a good website to stream newly released series online?
@Kristian Eugene flixportal
@Enrique Briggs thanks, I signed up and it seems like a nice service :) Appreciate it !!
@Kristian Eugene happy to help =)
New to .net core - your series has helped a lot many thanks.
Great to hear, Anthony! Do let know in case you need any specific areas covered.
Well structured and fully loaded.
Very nice. Great explanation.
Glad you liked it! Hope you are liking the full series bit.ly/asp-net-core-series
I'm enjoying your videos bro... I'm acquring a lot of knowledge this festive season.
Quite informative, have started implementing in my project work 👍
Glad it was helpful! Also check out the full series here bit.ly/asp-net-core-series
you have our full support . you just go on and create ow-some contents . i am started sharing you channel and videos to my colleagues and friends
Thank you for your help and support! Much appreciated and is a great motivation to keep making videos 😀 Do drop in topic suggestions as and when you have any
Fantastic Rahul !!
Thank you! Glad it helped
I wish if I could have ability to rise count of likes to 1000 personally.❤
Thanks Rahul, for your efforts and hard work to make our life easy and improving. 😊
Thank you for your kind words. You've made my day. Hope you are enjoying the full series bit.ly/asp-net-core-series
Hey Rahul, Another great content, next time delete weather controller and create new one :)😄
haha, thanks Jay 😃
Awesome video 👌 Thank you for making such videos 🙏
Glad you like them! Hope you are enjoying the full series bit.ly/asp-net-core-series
So Basically set everything as nullable and use fluentvalidation to validate based on your needs ?
Is this the way ?
Also I watched your model binding video,
It didn't really mention how can we create a custom binder to show our own descriptive messages in case of parsing Erros,
would love if you clarify on that in text/video.
Hello Rahul !! Would it be possible to cover videos on authentication and authorization in .net core web api. Thank you for sharing your content with us :D
Hey Niraj, Yes that is coming soon. Needs a lit bit more prep work for it.😃
Really nice video. Thank you so much.
Thank you and happy you liked it Sovann.
Hi@@RahulNath Is it possible if we want to custom return format after we send POST for validate MyData. For example, instead of return
{
"type": "",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "|cab6akdalekldfdaf",
"errors": {
"Age": [
"The field Age must be between 18 and 32432432"
]
}
}
I want something like
{
"some_new_field": "...........",
"title": "Custom message for title. I want to write what ever I want.",
"status": 400,
"errors": {
"Age": [
"Custom message for Age. I want to write what ever I want."
]
}
}
How to achieve this? What code that I could get the return body of validation? Thank you advance.
@@sovannseung6985 Does this help stackoverflow.com/questions/54942192/how-to-customize-error-response-in-web-api-with-net-core
Think it is something similar to what you are looking for?
@@RahulNath Thank you so much Rahul. That exactly what I am looking for. Looking forward to see more video from your chancel about .Net Core. Have a good holiday bro.
@@sovannseung6985 Cool thanks, You too!
Good job, thanks!
Thank you too!
Great tutorial rahul 👍
Thank you! Cheers!
I have a requirement to change database connection based on end point. For example, i have to connect offline SQl serve for gET calls and for POST/PUT i have to connect oltp server. I am thinking we can handle it in Filters... but didn't get clear idea. do you have any videos on Asp.net core Filters?
Yes I do have videos on filter - Do checkout the playlist bit.ly/asp-net-core-series. Hope you were able to resolve the issue.
taking a bow
Thank you Gangadhar🙏
Hi Rahun thanks alot for this model validation lecture. Which ide are you using?
Glad you like it . I used Jet Brains Rider www.jetbrains.com/rider/
@@RahulNath
Hey rahul, Explantion is very good. Can you tell us something about Caching(InMemory/Thirdparty) and Bundling and Minification in ASP.NET Core 3.1 bcz official docs are pretty confusing..plz have a look
Hey Pritish, Glad you like the videos and thank you for the topic suggestion. Have added it to my list and will try and cover it some time in the coming months.
please explain little bit slowly.
Thanks Rajesh for your feedback. This has been one feedback that I got on my earlier videos and thought I had improved on it. I will try and make it a bit slower. Meanwhile, does watching on a slower speed on RUclips help on the existing videos? (support.google.com/youtube/answer/7509567?co=GENIE.Platform%3DDesktop&hl=en)