Was just watching this video and the previous conventional routing video to get a handle on MVC routing. This video was so brilliant that I'm going to watch the entire series. Thanks mate from Australia.
12:09 I've tested this attribute routing but I've encountered errors with this Error: This localhost page can't be found "localhost:4259/home/index" Other links are fine: "localhost:4259/" "localhost:4259/home" "localhost:4259/home/details" "localhost:4259/home/details/1" Please answer me @kudvenkat
I refuse to learn .net core because you have not done a tutorial on it. Now that you have done? and now that i have seen your tutorial to this level, i can say that you are the best .net instructor in the whole world
At 4:35 you can optionally also just change the attribute to: [Route("Home/Details/{id=1}")] and leave the rest identical, this also creates the default behaviour (using core 3.0 btw). I don't know if this method has any drawbacks.
Hi Venkat, I would like to ask regarding the token replacement in attribute routing. When we navigate to URL (localhost:15410/home), the Index action method is executed and we are able to see the list of employees. You mentioned that is because of the [Route("")] attribute on the Index action method working in combination with the [Route("[controller]")] attribute on the HomeController. Notice in the URL we have the path "home", so the [controller] token is replaced with "home". However, I don't understand what do you mean we made the Index action within the HomeController the default action by including an empty route template [Route("")] ???
is there a way to navigate to a specific action when a navigation link is clicked without changing the url. like url= localhost:5544 and url = localhost:5544
um what is the advantage of this if you can do something like [HttpGet("Controller/Action/{ID}")] and then in your view you can access it like Show One I am asking because this is how I learned how to do it in my coding bootcamp so trying to figure out what is the best route to go :)
How can i get the person's name to show in the show in the url optionally to the default id? i.e ...myhost://home/James as well as myhost://home/1 I am using Core 2.1 Thanks
What is the best practice, use the config settings or use the attrib path?. If I have a lot of controllers and actions it's better to have all the routing in one place (centralized) or specify for each controller and action (distributed)?
Best Practices, well it depends on your situation and project that you are working, basically when you are building Web Api project, you should use attribute routing, because it gives your controller and action level control for url. Conventional routing when you are building web application. Well, you could also customize your url using conventional based approach.
In most of the cases you may not want to change the url if you rename the class name or function name of controller. Since it would be a breaking change for the clients.
Was just watching this video and the previous conventional routing video to get a handle on MVC routing.
This video was so brilliant that I'm going to watch the entire series. Thanks mate from Australia.
You are just a legend sir.. I was searching for routing tutorials very badly.. You just nailed it!
I am glad to see you're staying fresh with the new tech including net core keep the good work
Love how thorough, clear and calm you explain everything!
The best .net core tutorial on RUclips
I really like the video. It help me lot to learn thank you very much to make such wonderful tutorial.
Binge watched the whole series. It's amazing, keep it up! :)
12:09 I've tested this attribute routing but I've encountered errors with this
Error: This localhost page can't be found
"localhost:4259/home/index"
Other links are fine:
"localhost:4259/"
"localhost:4259/home"
"localhost:4259/home/details"
"localhost:4259/home/details/1"
Please answer me @kudvenkat
Very nice and clear explanation of attribute routing! (Y)
Wow cool feature, and well explained and demonstrated!
Once again, excellent tutorials!
Crystal clear explanation!
awesome
Thank you for this wonderful presentations.
I refuse to learn .net core because you have not done a tutorial on it. Now that you have done? and now that i have seen your tutorial to this level, i can say that you are the best .net instructor in the whole world
Best explanation!
At 4:35 you can optionally also just change the attribute to:
[Route("Home/Details/{id=1}")]
and leave the rest identical, this also creates the default behaviour (using core 3.0 btw).
I don't know if this method has any drawbacks.
Or public ViewResult Details(int id=1) {...}
Super useful, thank you 💙
Please discuss OAuth and Web API versioning.
Yes plz Oauth2 flows
The null-coalescing C# operator "??" did not work in my code. I looked it up, and this is because it was only introduced in C# v8.0.
Well done!
very clear nicely put
Thumbs up!
Great video
Thanks!
Great
simply, great
Hi Venkat,
I would like to ask regarding the token replacement in attribute routing. When we navigate to URL (localhost:15410/home), the Index action method is executed and we are able to see the list of employees. You mentioned that is because of the [Route("")] attribute on the Index action method working in combination with the [Route("[controller]")] attribute on the HomeController. Notice in the URL we have the path "home", so the [controller] token is replaced with "home".
However, I don't understand what do you mean we made the Index action within the
HomeController the default action by including an empty route template
[Route("")] ???
Thank you very much!
is there a way to navigate to a specific action when a navigation link is clicked without changing the url. like url= localhost:5544
and
url = localhost:5544
Thanks for sharing this
@Kudvenkat : In controller level, Can we use Route["Home/"] to avoid one more route in action method!?
So does the attribute route override the route generated by the UseMvc() conventional method?
um what is the advantage of this if you can do something like [HttpGet("Controller/Action/{ID}")] and then in your view you can access it like Show One I am asking because this is how I learned how to do it in my coding bootcamp so trying to figure out what is the best route to go :)
How can i get the person's name to show in the show in the url optionally to the default id?
i.e ...myhost://home/James as well as myhost://home/1
I am using Core 2.1
Thanks
What is the best practice, use the config settings or use the attrib path?. If I have a lot of controllers and actions it's better to have all the routing in one place (centralized) or specify for each controller and action (distributed)?
Best Practices, well it depends on your situation and project that you are working, basically when you are building Web Api project, you should use attribute routing, because it gives your controller and action level control for url. Conventional routing when you are building web application. Well, you could also customize your url using conventional based approach.
Thanks Venkat.
In most of the cases you may not want to change the url if you rename the class name or function name of controller. Since it would be a breaking change for the clients.
Kudvenkat and Chill
Perfektion
Why to use [Route] attribute on an action method when you can use HTTP Verb method?
Sir I am getting 404 error while giving like this : localhost:64947/Home/Index, I have implemented the same like you
For net core 3, if you want to use endpoints use
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
6 May 2021
Dear sir one request can you please put number with title in videos
It's all in a playlist anyways for easy viewing and the number is in the thumbnail of the video
I am the first to comment today
Im the first to comment the first comment today :)