RUVIDEO
Поделитесь видео 🙏

Controllers In MVC

Controllers In MVC:
In MVC the URLs are mapped to the Controllers action method so the question is how URLs are mapped to the Controllers action method? The answer for that ASP.NET routing. It is registering in Global.asax file.


The Registeroute method Is present in RouteConfig.cs file see below image,


Below is the RegisterRoute method in that class file.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}

In the above code, you can see, the Default route is present it means if you simply run the application then it will invoke this URL path the normal path which you see after run application https://localhost:44374/.
This URL is the same as https://localhost:44374/Home/Index this URL is the same as the above URL. The controller is Home and action is Index.
So in the RegisterRoute method MapRoute method if see id is an optional parameter but if you pass and you need to access this you need to modify action method signature in controller and code looks like this below.



This is one way to get QueryString parameter from URL to action but you can also use our older way to access the parameters. Use the below method for that.

public ActionResult Index(string id)
{
ViewBag.id = id;
ViewBag.name =Request.QueryString["name"];
return View();
}
Above id code for that, in above code we use Request.QuerySting method to access URL parameters and application works as expected.


In Register.Route method one more method
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
Which is used to ignore the file whose extension .axd. It means that the request is not passed to the below MapRoute method and file directly get from this.


Github- https://github.com/Sagar-Jaybhay/MVC5
article Link -https://sagarjaybhay.net/controllers-in-mvc-by-sagar-jaybhay-2020/

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Controllers In MVC», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.