by clintmcmahon | May 6, 2022 | ASP.NET, C#
Today I had a requirement to calculate someone’s age based on that person’s birthday. It seems like a pretty simple function to write, but I decided to Google around a little bit anyway to see if what other people were doing to calculate age based on...
by clintmcmahon | May 13, 2021 | ASP.NET
Here’s a quick way to set the active class on the current URL with a .Net MVC application. 1. Set a string variable equal to the request path at the top of the layout or view: @{ string path = Context.Request.Path; } 2. Check the path variable against whatever...
by clintmcmahon | Apr 26, 2021 | ASP.NET
One of my clients has an Umbraco 7 site that pretty much takes care of itself other than a few minor content updates here and there. Today that client asked we set up a redirect from an internal URL to an external domain for their job postings. Normally this is an...
by clintmcmahon | Jan 15, 2021 | ASP.NET, C#, Code
I’m working on a new .Net Core 5 web app with user authentication where I need to customize some of the Identity account pages (Login, Register, Forgot Password, etc). Out of the box these pages are built into .Net Core so there’s nothing you need to do to...
by clintmcmahon | Feb 7, 2020 | Code, ASP.NET, C#
This is an example of how to convert a generic list to a dynamic downloadable .csv file using C#, the CsvHelper library and the FileStreamResult. Download the repo and run the full project solution from Github In this example a request comes into the controller, we...