Merge pull request #757 from mlintner/master
[mono.git] / mcs / class / System.Web.Mvc3 / Mvc / ChildActionOnlyAttribute.cs
1 namespace System.Web.Mvc {
2     using System;
3
4     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
5     public sealed class ChildActionOnlyAttribute : FilterAttribute, IAuthorizationFilter {
6
7         public void OnAuthorization(AuthorizationContext filterContext) {
8             if (filterContext == null) {
9                 throw new ArgumentNullException("filterContext");
10             }
11
12             if (!filterContext.IsChildAction) {
13                 throw Error.ChildActionOnlyAttribute_MustBeInChildRequest(filterContext.ActionDescriptor);
14             }
15         }
16
17     }
18 }