Blog


  • Impersonation in Identity Server 3

    This is just a quick post for my implementation of impersonating a user in Identity Server 3 as a followup from a conversation on github. This code is stripped of all of the config and security within Identity Server and the client application, but it should be pretty easy to plug into whatever you have.

  • SharePoint 2010/2013 Custom ULS

    SharePoint has an awesome logging system. Anything that happens in SharePoint can be found in the ULS, and it's highly configurable as to what type of detail you see. In MVC applications, there are 100 different logging frameworks and destinations, but while you are in SharePoint, your code should log to the same place everything else does. A simple way to log would be to make a call to SPTrace, but you lose the ability to name your "product" and get full customization of the logging levels. A better option is extending the SPDiagnosticsServiceBase class with your own custom logging class. It is much easier to use in larger projects, and allows you to make full use of the configuration options in central admin. Here is the class I use, scroll below the class for some notes:

  • Useful Knockout JS Validation Rules

    Knockout validation is an excellent starting point for adding validation rules to your apps. This is my collection of extra rules I add to my projects to fill in some gaps in the base.

  • 5 Useful Knockout JS Binding Handlers

    Knockout JS is an awesome MVVM framework and is probably my favorite templating library. That being said, there are a couple helpers I add to every project to make it more useful in real work applications. (Note: all markup examples are using bootstrap

  • MVC Windows Authentication with AD Groups

    When working with Windows auth and using AD groups to manage authorization in an MVC application, performance can be terrible and changing environments is just not friendly with the out of the box authorization attributes in MVC. Below are a couple tricks I use to make things works faster and more dynamically.

  • SQL Wildcard Search

    Today I was working on filtering a database table's results to a specific type of data on a project and learned something fun. I was using raw SQL queries to get a view of the data before I put it into entity framework and I was getting a weird result set. I knew the data had an underscore as a separator for the data I needed, so my filter looked kind of like this:

  • Fast Cross Browser jQuery Select Filter

    I was working on an existing SharePoint project which had a custom control with a large select list populated with a few thousand items. To make it easier to use the select list, a textbox was used which filtered the list as the user typed. It was ok in chrome, terrible in FF, and downright painful to use in IE. Below is my rewrite of the filter code which is instant across all browsers (IE8+, didn't have a 7 to test). The original function did the regex search on the existing list sets and removed items that did not match. To restore removed items as the search was cleared or letters removed from the search box, the rest of the options would be removed and then it would loop through a cached list of the original option set and append them to the DOM object of the select one at a time.