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 withChildActionOnlyAttribute
can be called only with theAction
orRenderAction
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:
Post a Comment