ChildActionOnly in MVC | Advanced MVC 5 concepts

WebGentle
WebGentle
12.9 هزار بار بازدید - 6 سال پیش - MVC Tutorial: What is ChildActionOnly
MVC Tutorial: What is ChildActionOnly in MVC?
ChildActionOnly in MVC in a very important filter that is used to secure your public action method. In MVC application, when you create an action method for rendering a partial view then you also face some issue.
Issue - We generally create a public action method inside a controller to render a partial view (Called from view using @Html.RenderAction). Since the method is public and is availabe in controller, It means this method can be called directly from the browser also. To call this action method we can use domain.com/Controller/ActionMethod. And you will notice that data gets render in browser.
To avoid this type of problem we need a solution where out ActionMethod should be called from View only not from the OutSide (Directly from client/ browser).
To solve this problem MVC provides a filter named as ChildActionOnly attribute.
This filter is used as an attribute over an action method. And when you use ChildActionOnly then that particular method can be called from a view only not from outside i.e
(broswer/client).

In this video, you will learn what is ChildActionOnly in detail and how to use ChildActionOnly in MVC 5 application.
You will also learn what is the difference between NonAction and ChildActionOnly.

Timestamp:
Objective of video 00:17
Why should we use ChildActionOnly  00:35
Demo 01:32

#MVCTutorial #ChildActionOnly #MVC

Subscribe WebGentle: https://goo.gl/PJr1pN
Visit Our Website:  https://www.webgentle.com
Join WebGentle Community: https://www.webgentle.com/community
Visit WebGentle Blog: https://www.webgentle.com/blogs

For business enquiry contact: [email protected]

Follow us on
==========
Facebook - Facebook: webgentle
Linkedin - LinkedIn: webgentle
Twitter - Twitter: webgentle

Popular free courses from WebGentle
=========
Jira tutorial – http://bit.ly/jiratutorial
Azure DevOps tutorial - http://bit.ly/azuredevopsbynitish
.NET Core 3.0 fundamentals - http://bit.ly/dotnetcore3
MVC5 tutorial - http://bit.ly/mvcbynitish
LINQ Tutorial - http://bit.ly/linqbynitish
Non generic collection in c# - http://bit.ly/nongenericcollectionbyn...
6 سال پیش در تاریخ 1397/08/12 منتشر شده است.
12,942 بـار بازدید شده
... بیشتر