Archive For July 2015
Implementing Google's EU End User Consent Policy
calendar_today 29 July 2015 21:56
The European Union introduced laws some while ago requiring web sites to obtain consent from EU visitors to allow the use of cookies. Most larger corporate sites have implemented a policy for obtaining consent - or an "implied consent" solution, but countless smaller sites and blogs like mine have not bothered. That's about to change for a number of us who are Google Adsense publishers (we carry Google adverts on our sites) because Google has introduced a new EU user consent policy which must be followed by those of us who use products like Google Adsense (and who want to continue using them). This article is a quick overview of what the policy is about, and how I implemented a quick and effective solution.
Solved - The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine
calendar_today 23 July 2015 20:05
There are a number of reasons why you might get "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine" error when attempting to connect to either an accdb or an xlsx file, depending on what you are doing. This article discusses some of the causes and provides solutions first for uses involving ASP.NET, and then looking at other application uses.
Reading Text-based Files In ASP.NET
calendar_today 17 July 2015 13:43
Every time I need to work with the contents of text-based files in an ASP.NET application I invariably start off thinking about using the various static methods on the System.IO.File
class to extract the text and then some string manipulation or Regex to parse the content into some kind of structure. And, just in time, I remember the TextFieldParser
class that hides itself away in the Microsoft.VisualBasic
assembly. The purpose of this article is to introduce this component to a wider audience, but also to serve me as an aide-mémoire in terms of the basic usage, which I always have to look up.
A Better Way To Export Gridviews To Excel
calendar_today 07 July 2015 13:49
There are countless articles that demonstrate exporting ASP.NET GridViews to Excel. They pretty much all do the same thing - they use the RenderControl method to generate HTML and then save it to a file with a .xls extension. This kind of works, but the resulting file is actually an HTML file masquerading as an Excel file. And that has two flaws: it cannot be used as a data source because providers complain that it is not in an acceptable format, and users of Office 2007 or newer are always confronted with a warning about the contents of the file when they try to open it, causing confusion, suspicion or annoyance. This article shows how to use the free, open source library to export the content of a GridView control to a genuine .xlsx file that doesn't suffer these problems.