MrMistreater

Custom validation attribute with current context

May 15th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.30 KB | None | 0 0
  1.         public Func<HttpContextBase> ContextProvider = () => new HttpContextWrapper(HttpContext.Current);
  2.  
  3.         public override bool IsValid(object value)
  4.         {
  5.             if (value == null) return false;
  6.             var identityName = ContextProvider().User.Identity.Name;
  7.         // ...
  8.     }
Advertisement
Add Comment
Please, Sign In to add comment