Tuesday, May 12, 2015

Decorate Controller Actions with [ChildActionOnly]
/In the controller: [ChildActionOnly] [OutputCache(Duration=2000)] public ActionResult TagsForPost(int postId) { return View(); }

Notice the ChildActionOnly attribute. From MSDN:
Any method that is marked with ChildActionOnlyAttribute can be called only with the Action or RenderAction HTML extension methods.
This means people can’t see your child action by manipulating the URL (if you’re using the default route).

No comments: