Geeks With Blogs
.Nettuce Code Salad January 2011 Entries
Global ValidateAntiForgeryToken in MVC3
public class GlobalValidateAntiForgeryToken : AuthorizeAttribute { public override void OnAuthorization(Authorizati... filterContext) { if (filterContext.HttpContext.... == WebRequestMethods.Http.Post) { new ValidateAntiForgeryTokenAtt... } } } And add to the Global.asax: public static void RegisterGlobalFilters(Globa... filters) { filters.Add(new GlobalValidateAntiForgeryTo... } ......

Posted On Sunday, January 30, 2011 9:24 PM

Generic IEqualityComparer
A generic equality comparer that takes a property to compare or a comparison functionpublic class GenericComparer<T> : IEqualityComparer<T> where T : class { readonly Func<T, object> propertyToCompare; readonly Func<T, T, bool> comparisonFunction; public GenericComparer(Func<T, T, bool> comparisonFunction) { this.comparisonFunction = comparisonFunction; } public GenericComparer(Func<T, object> propertyToCompare) { this.propertyToCompare = propertyToCompare; } public ......

Posted On Tuesday, January 11, 2011 11:43 PM

Copyright © Jon Canning | Powered by: GeeksWithBlogs.net