Tech Blog

Typed AppSettings in .net core

By: Chris Dunn on Tue Apr 9, 2019 (5 min read)

It's always easier to work with typed information in a program than trying to remember string keys in a configuration file. So when working with the appsettings.json file in .net core, I advise you load the configuration file into a class object and work with the object directly, instead of GetSection() repeatedly throughout your code. It's also a good idea to create the class object as a service so you can inject it into controllers for ease of use while still maintaining test-ability. I'll do ...

Determine Current Operating System in .Net Core

By: Chris Dunn on Tue Mar 5, 2019 (2 min read)

What Operating System is my .net application running on?  Seems weird to ask that question doesn't it.  But with .net core we now have the opportunity to more easily deploy cross-platform solutions using .Net and C#. So previously the question of which OS platform we were running for our application didn't really concern many .net developers. Fortunately, we now have to consider such things. (I'm not forgetting mono). Luckily .Net Core has us covered with OS information included with the Runtime ...

Configure Sessions in .net core

By: Chris Dunn on Tue Feb 5, 2019 (4 min read)

With .net core, if you want to use functionality you will, in most cases, need to explicitly configure it yourself via middle ware.  This is actually a good thing.  It keeps your code and dependencies clean.  So if we want to utilize sessions in our application, we'll need to configure the middle ware. Configuring Sessions Even though you need to configure it yourself, it's not hard by any means. I'll explain the process and then show the code.  First you will need to add the following code in t ...

Configuring Cors Policy in .net core

By: Chris Dunn on Tue Nov 20, 2018 (3 min read)

To allow sharing responses cross-origin and allow for more versatile fetches than possible with HTML’s form element, the CORS protocol exists. It is layered on top of HTTP and allows responses to declare they can be shared with other origins. Source They is a lot more in depth information on CORS than I could provide here in my post so I will rely on others if you are unfamiliar with what it's all about. See a good explanation from Mozilla. My goal for this post it to show you how to configure a ...

Copyright 2023 Cidean, LLC. All rights reserved.

Proudly running Umbraco 7. This site is responsive with the help of Foundation 5.