---
title: "What is ChildActionOnly Attribute in MVC ?"  
description: "What is ChildActionOnly Attribute in MVC ?"  
author: "Rahul Roi"  
published: 2020-10-28  
updated: 2020-10-28  
canonical: https://www.mindstick.com/forum/156061/what-is-childactiononly-attribute-in-mvc  
category: "asp.net mvc"  
tags: ["asp.net mvc", "mvc"]  
reading_time: 1 minute  

---

# What is ChildActionOnly Attribute in MVC ?

ChildActionOnly [Attribute](https://www.mindstick.com/blog/221/attributes-reflection) in [MVC](https://www.mindstick.com/forum/155803/define-cache-profile-in-mvc)

## Replies

### Reply by Rahul Roi

## ChildActionOnly Attribute in MVC

- Into the ChildAction methods will not be responded to incoming URL requests. If you try to invoke the childActions using URL, then you will get a runtime error saying – ChildAction is accessible only by a child request.
- We can only access the child action methods by making a child request from a view either by using the “Action()” or “RenderAction()” HTML helper methods.
- Here, the most important point that you need to remember is, an action method doesn’t need to have the ChildActionOnly attribute to be used as a ChildAction. We need to use this ChildActionOnly attribute only if you want to prevent the action method to be invoked using URL.
- The ChildAction methods are different from the NonAction methods in the MVC application. Here, the difference is that the NonAction methods cannot be invoked as a child request either by using the Action() or RenderAction() HTML helpers.
- The main advantage of the Child Action method is that you can cache portions of a view. We will discuss this in the OutputCache Attribute article.


---

Original Source: https://www.mindstick.com/forum/156061/what-is-childactiononly-attribute-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
