1 namespace System.Web.Mvc {
3 using System.Diagnostics;
5 using System.Web.Helpers;
7 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
8 public sealed class ValidateAntiForgeryTokenAttribute : FilterAttribute, IAuthorizationFilter {
14 return _salt ?? String.Empty;
21 internal Action ValidateAction {
26 public ValidateAntiForgeryTokenAttribute()
27 : this(AntiForgery.Validate) {
30 //Modified to compile MVC3 with the newer System.Web.WebPages helpers
31 internal ValidateAntiForgeryTokenAttribute(Action validateAction) {
32 Debug.Assert(validateAction != null);
33 ValidateAction = validateAction;
36 public void OnAuthorization(AuthorizationContext filterContext) {
37 if (filterContext == null) {
38 throw new ArgumentNullException("filterContext");
41 //Modified to compile MVC3 with the newer System.Web.WebPages helpers