C-Sharp

A collection of 31 posts
DevOps

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
1 min read
ASP.Net

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
Programming

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
3 min read
C-Sharp

VSO Build and File Select/Exclude

Hey all, so today I wanted to use the new (finally) feature of pushing nuget packages to nuget feeds inside of Visual Studio Online's build environment. Which is turning out to be really awesome by the way. Anyways, I'm doing a vNext project and it creates 2 nuget packages *.nupkg. I create a new Nuget Publish task and it set the default. First, it won't work correctly, it'll try and upload some downloaded nuget packages. Lame. So we need to change the default of **\*.nupkg to **\artifacts\**\
2 min read
ASP.Net

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; }
2 min read
C-Sharp

Certificate information and Fiddler

So, one of my biggest gripes with fiddler is not being able to see what the original ssl cert the server was spitting out was. If you decrypt the ssl traffic, fiddler acts like a man-in-the middle and replaces the server certificate with it's own so it can decrypt it. If you don't understand that very well, google will help alot more than I can. So. Long story short, I needed to know what ssl certificate the web servers were spitting up, even if Fiddler was running. Fiddler doesn't have this
1 min read
C-Sharp

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: https://github.com/veccsolutions/Vecc.WebSecurity It's really easy to use. Hopefully you al
C-Sharp

Create content type in Umbraco

Hi, this is one of my first posts on programming in Umbraco. And it's about programatically creating a content type and assigning the available child content types. It's actually pretty easy once you spend a day digging through code, so I figured I would share my knowledge. To create the content type is pretty straight forward. First, all of the using statements needed for this exercise. using System.Collections.Generic; using System.Linq; using umbraco.interfaces; using Umbraco.Core.Models;
2 min read
C-Sharp

WCF and external .config file

Hi all, it's been awhile. I've been pretty busy. Anyways, I just had a requirement, due to limitations of the software I'm working with, to load WCF configuration I had to do it from a file other than the web.config. I started out thinking this was going to be an easy task, wrong! Took a day of plugging away, but I finally found it. My requirements were, load config from external file and be able to use the standard WCF config sections. There are 3 main steps to this. Load the external config
6 min read