Eli Weinstock-Herman
"If it wasn't hard, everyone would do it. It's the hard that makes it great."
Tom Hanks

Custom Authentication in ASP.Net Core (without Identity)

Original post posted on Friday, September 8, 2017 at LessThanDot.com

Performing Authentication and Authorization has changed from ASP.Net to ASP.Net Core. Rather than relying on attributes, ASP.Net Core uses middleware similar to NancyFX and Rails. This is a short, step-by-step approach to implementing custom Authentication in ASP.Net Core without the overhead (and assumptions) of the new Identity model.

The goal is to support basic necessities like a Login page with cookie-based authentication tickets that properly require HTTPS in production, but gracefully fail back to HTTP in local development.

Cookie...

Continue reading

Deploying to ServiceFabric from TeamCity

Original post posted on Monday, August 7, 2017 at LessThanDot.com

Recently I’ve been working on an application that runs partially in Azure ServiceFabric. I’ve created a local cluster to work against and now it’s time to configure my TeamCity deployment to deploy upgrades to my application automatically.

Initial details:

  • Deploying 2 projects:
    • a .Net 4.6.2 ASP.Net Core app to web app
    • .Net 4.6.2 ServiceFabric project to ServiceFabric cluster
  • Server:
    • VM: 2-core, 2048 GB of RAM
    • Windows Server 2016 x64
    • TeamCity 2017.1
    • SQL Server 2016

In the previous post I walked through the setup of a Service Fabric cluster on a local Hyper-V server...

Continue reading

Creating a local Service Fabric Cluster

Original post posted on Wednesday, July 26, 2017 at LessThanDot.com

Working with Service Fabric and want a local cluster to test and develop against? Here’s the step-by-step path I took from a set of fresh Windows VMs to a running, secured Service Fabric cluster using self-signed X509 certificates. There are a number of Microsoft docs that cover this subject, this is a single beginning-to-end path that also includes fixes for gaps or errors in those docs as I went.

Here are the technical details:

  • 3 Hyper-V VMs running Windows 2016 x64, single-core, 2046MB RAM
  • ServiceFabric 5.6.220.9494

My VMs are:

  • SFNode0 – 192.168.1.200
  • SFNode1 –...
Continue reading

Multiple NuGet Methods for VS2017 + MSBuild 15 in TeamCity

Original post posted on Wednesday, July 19, 2017 at LessThanDot.com

ASP.Net Projects and NuGet have been a moving target the last couple years. I have an ASP.Net Core project (.Net Framework) with several class libraries and had to work through a number of problems to get NuGet Restore working on a TeamCity CI server. Hopefully this will help someone else along the way.

It turns out I have 3 situations:

  • ASP.Net Core uses the new PackageReference for packages instead of packages.json
  • Other C# Projects still use the packages.json method for packages
  • Solution packages (great for tooling) are (still) not supported after VS 2013 (NuGet #522)

(the last couple...

Continue reading

Mapping Complex types to/from JSON with JSON.Net

Original post posted on Friday, July 7, 2017 at LessThanDot.com

In an earlier post I introduced a strongly typed Identity object I am using in an ASP.Net Core application to make my code and error messages more readable. I didn’t wanted that extra complexity reflected in my database or over the wire with an API. In this post we’ll look at a simple method to map my strongly typed properties in C# to simpler values in JSON.

This is my desired state:

I want a strongly typed Identity object in my API backend that transparently converts into a simple int value to/from the database and converts to an int or null for the front-end (null in cases...

Continue reading

Useful Projects