A collection of 19 posts


node/npm/gulp/continuous integration

Alright, so I have continue integration for my new dotnet core applications. Building works great. It's now time to publish. I'm using gulp on my pre-publish commands to move files, compile typescripts, minify css/javascripts, etc. It works fine for my user after running npm install gulp -g. But, because I want all of my publish and builds to be self contained, and it also doesn't work when running under my build user spitting out an error saying Error : 'gulp' is not recognized as an internal o


Custom model validation in ASPNET Core

I just wanted to post how to do custom model validation. It took me a few hours and it wasn't posted anywhere yet. So, I wanted to do my own model validation so I can call ModelState.IsValid and get whether the posted model was valid or not. I needed some custom code. In my case it was to make sure that only 1 of 2 boolean properties were set to true. After digging through the sources I found an easy way. Implement the System.ComponentModel.DataAnnotations.IValidatableObject interface. The def


ASP.NET vNext Custom Authentication

Welcome all, here's my delima. I need to be able to implement my own custom Authentication middleware in vNext. I needed to do this because of a requirement where I cannot use cookies. Reason being is that my site will be iFramed into another application. I know, its not a good solution, but it is what it is. There was little to no documentation on how to implement your own authentication middleware so I set out on a journey. It's relatively easy to set it up and get it going. Now, this is not f


From Nuget.Server to NugetGallery

Well, we started running into an issue with Nuget.Server and it was time to migrate to NugetGallery. Mainly, it wouldn't clean itself up (after a few days, there were 10's of gigs of temp files in c:\windows\temp\nuget), and now that we have a couple thousand packages it started really slowing down. It was just time. So here goes what I did to make this work. Initial Steps: 1. Clone NugetGallery from github 2. Configure NugetGallery settings (database, etc) 3. Modify the web.config in the N


ASP 5 vNext WebAPI Abstract/Inherited Classes

Good evening everyone, I've been fighting vNext, Web API and abstract classes. I just want to be able to pass an array into my API of a bunch of different types that all inherit a base class. Turns out it's a configuration option as vNext uses Newtonsoft.JSON to do the serialize/deserialize it was just a matter of finding it. Here's an example what I want passed into my API. public abstract class FilterBase { } public class Filter1 : FilterBase { public string FilterString { get; set; } }

Windows 10

Windows 10 - .NET 3.5

Ok, so here's the overall situation 1. Fresh Windows 10 Install 2. Installed IIS attempting to include .net 3.5 in this install - it failed pulling the package from Windows Update due to my WSUS server. 1_ Skipped the .net 3.5 and installed everything. IIS, .net 4.5, Hyper-V etc. 3. After fixing my Group Policy to pull from Windows Update I attempted to install .net 3.5 at which point I started getting a 0x800F081F during the install(among others). The fix. Uninstall IIS


Enhanced security in web sites (headers)

Hey all, so, just got back from a pretty good "Secure Coding" conference from SANS. Learned a lot of stuff. Including some simple countermeasure you can implement on you site. Not all browsers support them, but, with them, it helps prevent Cross Site Scripting. I have create a little .net library that will help with implementing them, along with a sample web app. I encourage you all to go look at it at: It's really easy to use. Hopefully you a



OK, this is really, really annoying. You should NOT have to do any config to support the 2 most widely used protocols on the internet, HTTP and HTTPS. Here's the simple, really simple, web.config to support both HTTP and HTTPS. You don't need all the attributes to do it, if you don't specify them, it will use the defaults. So, for simplicity sake, I didn't put them in. This is an example that I couldn't find on here you all go. <system.serviceModel> <bindings> <basicHtt


Session state on end of every request in

I had a need to access the session state on the end of every request, even those on Response.Redirect. It sounds simple, and it is. It just took a while to find out what method is always called on every page before the data (headers and content) is sent back to the client. Even on Response.Redirect's.In the global.asax file, it is the method Application_PostRequestHandlerExecute. It is the last method that is called that has access to the session state. Here's a basic example: using System; usi