Created
June 4, 2012 13:10
-
-
Save Dynyx/2868269 to your computer and use it in GitHub Desktop.
Custom validation attribute with current context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Func<HttpContextBase> ContextProvider = () => new HttpContextWrapper(HttpContext.Current); | |
public override bool IsValid(object value) | |
{ | |
if (value == null) return false; | |
var identityName = ContextProvider().User.Identity.Name; | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment