Friendly Enum Labels C# Extension

Here's a nice trick I recently found. Let's say you have an enum and want to render the enum choices to a dropdown list. But the enum values don't permit spaces, so they won't render in an easy-to-read fashion. This tip creates an extension for enums that allows for a string value decorator on each enum choice. The decorator permits a friendly name to be specified. The extension adds a method to all enums that make it easy to pull the friendly name value. Start by setting up an enum class like this: namespace CommerceBuilder.Products { public enum DigitalAssetType { ...

Oct 12, 2020 READ MORE
Could not load file or assembly ‘System.Web.WebPages, Version=2.0.0.0

Recently I moved an AbleCommerce Gold R12 install to Windows Server 2019. Immediately the RESTful Web API built into the app started responding with 404 errors. It was as if the MVC routes simply no longer existed even though they were clearly being built in the web api bootstrap code. Fast forward to today as I deploy a minor unrelated update to another DLL. As part of that update, the System.Web.WebPages dll was also deployed. Something recently had updated that DLL. While everything worked locally, suddenly the .Net application was throwing 500 errors. Couldn't even get an Except...

Jan 10, 2020 READ MORE
Hosting Classic ASP on Server 2008 R2

Ran into a problem today trying to light up a Classic ASP site that was a copy of an existing site on the same server. However HTTP 500 errors were all we could get. Once we enabled debug logging in ASP, we saw that there was a problem with the ADODB connection being able to open the MSAccess database within the site folders. Gotta remember to enable 32-bit apps in the application pool advanced settings. Note: Microsoft Access databases have been popular for many years with developers who use Active Server Pages (ASP) for small-scale applications, but Microsoft Access databases are n...

Nov 25, 2019 READ MORE
How to speed up site rebuild after compiling a DLL

Came across this little gem this morning.   Made a significant difference on my PC. Here’s the best one. Add this to your web.config for MUCH faster compilation. <compilation optimizeCompilations="true"> Quick summary: we are introducing a new optimizeCompilations switch in ASP.NET that can greatly improve the compilation speed in some scenarios. There are some catches, so read on for more details. This switch is currently available as a QFE for 3.5SP1, and will be part of VS 2010.The ASP.NET compilation system takes a very conservat...

Nov 25, 2019 READ MORE
Building an Audit Log with nHibernate Listeners in AbleCommerce

I have a client who can’t seem to figure out who’s making edits to certain products. Somebody changed the price, somebody marked it hidden. That sort of thing. Too many people in the back-end and no audit trail for who changed what. So I decided to dig into nHibernate listeners. After a brutal all-nighter reading StackOverflow posts and copying snippets from a few blog posts, I actually got it working. I added some new handlers for the Post-Commit-Create, Post-Commit-Update and Post-Commit-Delete listener events and pointed them to my AuditEventListener class. These are easily wired ...

Nov 25, 2019 READ MORE