Tag: Just Coding

How do I fix HTTP Error 502.5 - Process Failure when hosting in IIS with dotnet core

I received a new error today that I haven't received before when deploying dotnet core apps. It was as the title suggest a "HTTP Error 502.5 - Process Failure" error

 
Setting up 2 factor authentication and email verification with .net core 2.0

Today I played with a new .net core template just to see what the authentication options were out the box and was surprised to see just how easy it is to go from nothing to having a base project that has authentication fully baked in with 2 factor authentication and email verification.

 
Creating an asynchronous AuthorizeAttribute in MVC

A couple days ago I needed to call a remote web api call in my AuthorizeAttribute sometimes but as mentioned in this (Is it possible to use async/await in MVC 4 AuthorizeAttribute?) StackOverflow question (and other forums) it isn’t supported but is in the newer .net core. Unfortunately the project I needed this on was traditional MVC so I was left still finding a way Smile.

 
BenchmarkDotNet: IsBoolean method

This post might seem weird and is slightly. It's really just a pointer as with all my posts to send people to instead of sharing lots of text "on the down low" Open-mouthed smile.

 
Converting Html to Pdf using C# and magic!

Everyone at some point needs to convert and html page into a PDF for some reason or another. For this I've always used a component which was cheap at the time (and is far from it now). This component has worked well for the last 8(ish) years, most ish in the last while because it doesn't deal well with https sites. When contacting the vendor they said hey but our latest version which can be expected I guess because it's 8 years down the line but then came the it's ALL OF THE $ Smile. The last issue is that the component I used doesn't work in Azure. That lead me to some investigation and then ultimately this post.

 
Using ngrok to test web apps on mobile while developing

I often never really test on mobile properly because most sites are responsive so it's easier to just resize your browser and test like that. This works great until you trying to get the perfect mobile experience and looking at every element like how drop lists present themselves with different content taking into account how wrapping might happen in mobile browser controls (which is different from web browser, even in chrome Smile). A long time ago I briefly used ngrok just to test how it works and now I use it constantly for testing apps while they are still in development.

 
Implementing a dynamic robots.txt

Firstly you might want to know why would you want to implement a dynamic robots.txt? Isn't it better to just put a static file in the web app? Yes it is but when you running your application on certain platforms like web apps in Azure when you using deployment slots. I found this handy link which explains deployment slots quite nicely Smile, but basically what happens is when you switch 2 slots Azure will do a virtual IP switch so traffic from your slots will now be switched (not the files from each slot).

 
Using C# 6 to make 'bad' SQL awesome

I'm busy going through Pluralsight watching Exploring C# 6 with Jon Skeet by Rob Conery. Jon Skeet goes ahead and makes this epic method that looks like it's so naughty but is pretty cool.

 
Do you know Optional Parameters?

Up until about an hour ago I thought I knew how optional parameters worked but didn't actually. I thought (probably without giving it too much thought) that optional parameters would compile to something that would reflect having multiple overloads as when they came out I ripped out 100s of overloads across multiple libraries and replaces them with optional parameters because it replace code like