Windows Controlled Folder Access

I’d almost completed a major new Windows graphics application ‘Magic Water Mark’ when I hit a typical Microsoft road-block. My tried and tested routines for saving Image Files all failed to work – creating a System.Exception: “A generic error occurred in GDI+.”. Absolutely no helpful debug information available anywhere.

The problem appeared for an application using Visual Studio 2022 with .Net 8.0
Yet earlier Applications using Visual Studio 2019 with .Net Framework 4.8 still seemed to work fine!

Sods law make it almost impossible to change my latest project back to one able to use Visual Studio 2019 – so I wasted hours looking for solutions in the wrong place.

Google searches about GDI+ errors only produced suggestions for beginners trying to save images.
Hours of frustration were eventually rewarded when I slowly understood the error had nothing to do with GDI+ but instead a single manifested problem caused by Microsofts introduction of “Controlled Folder Access”.

“Controlled Folder Access” was created by Microsoft to prevent unwanted access to a PC’s data files – Documents, Downloads, Music and Pictures.
It can easily be turned On and Off by an administrator from Windows security.

With Controlled Folder Access turned on, only Microsoft Approved applications can write to files within Documents, Downloads, Music and Pictures folders – unless the application has been individually selected to allow it access to these folders.

Later searches into problems associated with Controlled Folder Access suggests it may cause all sorts of unexpected problems with legacy Windows software. There is absolutely no meaningful warning of what is going wrong!

Controlled Folder Access almost certainly eliminates the problem of RansomWare attacks – so I am happy to keep mine turned on.
But I’ve also been going through the older PC applications I use all the time and adding them to the list of Trusted Applications in Windows Security. This prevents them from being blocked by Controlled Folder Access and ensures they don’t end up behaving in weird or unexpected ways or maybe creating errors that I don’t even even notice.

Upgrade http to https for security

In the process of creating new software and websites, I thought it might be a good idea to improve this site by changing from http to https.
This is what I found I needed to do:

First make sure my hosting account had the necessary security certificate – D9 Hosting were on the ball and made their necessary changes within minutes after I raised a low priority ticket asking for help.

Next I added a few lines of code to the root directory ‘.htaccess’ file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Not sure whether this was needed or not – but wanted to make sure that all http requests were routed as https secure versions

Firefox and Microsoft Edge still weren’t at all happy – saying website was insecure. So my third step was installing the WordPress plug-in Search and Replace This allowed me to change all instances of ‘http://’ to ‘https://’ for all of my posts and pages. There were hundreds of these – one for each image.

Still not enough – browsers weren’t at all happy yet. So then I installed the String Locator plugin to search for all instances of ‘http:’ This discovered hundreds of instances throughout my theme and installed plugins.

Finally I gave in and decided to remove the plugins and edit each of the theme files one by one (after a FTP download in case things went wrong). Changing each instance of ‘http’ to ‘https’ took surprisingly little time.
Now browsers seem to be quite happy.

Good luck if you need to sort the same problem – and improve your Google rating.


Ideas to Improve Your WordPress Site

I create software for web users and am always on the look-out for ideas.
What I really want to find out is what people want – even though they may not know themselves.

One great place to look is the WordPress Plugin Directory
This lists all the great, freely available, wordpress plugins.
As usual, this got me sidetracked into wondering just how useful some of these plugins are.
One that really caught my attention was Shortcodes Ultimate
Short-codes allow your website to run proven pieces of software simply by entering a short name that replaces a function. So for example, a few letters in your code could create tabs, buttons or sliders – all fully tested and functional.

I’m particularly interested in checking out the upgrade that enables me to create my own short-codes.

Like all new toys, there will be a learning curve, but I’m hoping that in the long run it could save a lot of time and effort?