Items By Type: Tutorial

Implementing Google's EU End User Consent Policy

Wednesday, July 29, 2015 9:56 PM

Javascript HTML CSS jQuery

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.

Click to read more about Implementing Google's EU End User Consent Policy ...

Viewed 58 times

0 Comments for this item

Solved - The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine

Thursday, July 23, 2015 8:05 PM

MS Access ADO.NET EPPlus

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.

Click to read more about Solved - The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine ...

Viewed 142 times

0 Comments for this item

Reading Text-based Files In ASP.NET

Friday, July 17, 2015 1:43 PM

C# General ASP.NET MVC ASP.NET Web Forms

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.

Click to read more about Reading Text-based Files In ASP.NET ...

Viewed 290 times

0 Comments for this item

A Better Way To Export Gridviews To Excel

Tuesday, July 7, 2015 1:49 PM

ASP.NET Web Forms EPPlus

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.

Click to read more about A Better Way To Export Gridviews To Excel ...

Viewed 649 times

4 Comments for this item

Reading Excel Files Without Saving To Disk In ASP.NET

Tuesday, June 30, 2015 2:47 PM

ASP.NET Web Forms EPPlus

This article allows me the opportunity to demonstrate a feature of my newest favourite open source library: EPPlus. EPPlus is a .net library that reads and writes Excel 2007+ files using the Open Office Xml format (xlsx). This fantastic, easy to use (and free) library enables the use of Excel in ASP.NET applications without the need to install the Access Database Engine (ACE) or having to mess about with unsupported Office Automation on the web server (assuming you can even get Office installed there). Prompted by a rash of similar questions that appeared on the ASP.NET forums recently, this article looks at reading the contents of an uploaded Excel file without saving it, and displaying the data in a Web Forms GridView.

Click to read more about Reading Excel Files Without Saving To Disk In ASP.NET ...

Viewed 838 times

3 Comments for this item

Entity Framework Recipe: Many To Many Relationship On The Same Table

Thursday, June 18, 2015 1:56 PM

Entity Framework

This article looks at how to configure Entity Framework to manage many to many relationships based on the same table. This scenario arises the same entity is related to itself in a different role. An example is the related product feature you might see in a "People also bought" section of an ecommerce site. Another is the relationship between clients and agencies in the advertising and marketing world. That scenario will form the basis of the illustration below.

Click to read more about Entity Framework Recipe: Many To Many Relationship On The Same Table ...

Viewed 671 times

0 Comments for this item

Custom TagHelpers in ASP.NET MVC 6

Monday, May 18, 2015 1:45 PM

ASP.NET MVC ASP.NET 5

TagHelpers is one of the new features introduced in MVC 6, part of ASP.NET 5. They are used for generating reusable pieces of UI that require some kind of server-side processing. I took a closer look at the built-in collection of TagHelpers in my last article, Introducing TagHelpers in ASP.NET MVC 6. This article shows how to create your own custom TagHelpers. It will illustrate two ways of doing so: through parsing custom attributes; and by binding properties on the TagHelper.

Click to read more about Custom TagHelpers in ASP.NET MVC 6 ...

Viewed 2199 times

2 Comments for this item

Introducing TagHelpers in ASP.NET MVC 6

Monday, May 11, 2015 1:17 PM

ASP.NET MVC ASP.NET 5

TagHelpers is one of the new features introduced in MVC 6. The TagHelper's role is similar to the one played in previous versions of ASP.NET MVC by HtmlHelpers: they are designed to simplify the work required to author views that need to respond dynamically to the data provided to them. However, the way in which they work and their impact on view design is very different to HtmlHelpers.

Click to read more about Introducing TagHelpers in ASP.NET MVC 6 ...

Viewed 5460 times

2 Comments for this item

Using the HtmlAgilityPack to parse HTML in ASP.NET

Thursday, April 30, 2015 1:26 PM

HTML General HTML5

Hardly a week goes by without someone asking a question in the ASP.NET forums about parsing HTML for one purpose or another. Mostly, the questions are couched in terms of 'finding values' or similar, prompting responses from the community that recommend one regular expression pattern or another, treating HTML as a string of text with no structure or rules. In fact, HTML is a structured document format with a set of very clearly defined rules, which means that it can easily be parsed given the right tool. My favourite tool for parsing HTML is the HtmlAgilityPack.

Click to read more about Using the HtmlAgilityPack to parse HTML in ASP.NET ...

Viewed 2919 times

1 Comment for this item

Entity Framework Recipe: Storing And Managing Time

Thursday, April 23, 2015 1:19 PM

ASP.NET MVC Entity Framework

This post explores the options available to you when your application requirements include managing and storing time using the Entity Framework. Specifically, I am thinking of durations of time, such as the time required to complete some kind of task, not the time part of a date. Relevant examples might include storing the length of a movie, or the preparation time required for a recipe.

Click to read more about Entity Framework Recipe: Storing And Managing Time ...

Viewed 3132 times

2 Comments for this item

7 C# 6.0 Features That Every ASP.NET Developer Should Know About

Tuesday, April 14, 2015 1:25 PM

C# ASP.NET 5

Visual Studio 2015 introduces a completely new version of ASP.NET, but it also includes version 6 of the C# language. Previous new versions of C# have heralded substantial changes like the introduction of async and await in version 5, dynamic in version 4, LINQ in version 3 and so on. There are no major feature changes or introductions in version 6, but there are a number of syntactical improvements that you are likely to use on a daily basis. Here's a rundown of them.

Click to read more about 7 C# 6.0 Features That Every ASP.NET Developer Should Know About ...

Viewed 11242 times

7 Comments for this item

Sessions in ASP.NET 5

Tuesday, April 7, 2015 1:39 PM

ASP.NET MVC ASP.NET 5

ASP.NET 5 is being designed so that your application is only dependent on features that it actually needs. This is achieved in large part by creating a composable framework, where the developer opts in to non-essential features - a number of which are baked in to traditional versions of ASP.NET. One of the features that this applies to is Session State. This article looks at how to obtain and use session state in ASP.NET 5 applications.

Click to read more about Sessions in ASP.NET 5 ...

Viewed 17837 times

15 Comments for this item

ASP.NET 5 Middleware, Or Where Has My HttpModule Gone?

Tuesday, March 31, 2015 1:22 PM

ASP.NET MVC ASP.NET 5

ASP.NET 5 has been largely rewritten from the ground up, and incorporates some radical changes when compared with previous versions of ASP.NET. One of the biggest changes is in the HTTP Pipeline. This article looks at how those changes impact the design and registration of plug and play components that used to be represented by HttpModules.

Click to read more about ASP.NET 5 Middleware, Or Where Has My HttpModule Gone? ...

Viewed 15813 times

8 Comments for this item

How To Send Email In ASP.NET MVC

Tuesday, March 24, 2015 1:21 PM

ASP.NET MVC

This article takes a comprehensive look at the business of generating and sending email from an ASP.NET MVC application. It covers the most common use cases as well as some advanced scenarios. It also explores some of the more common errors that arise from attempting to generate and send email programmatically from an ASP.NET MVC site.

Click to read more about How To Send Email In ASP.NET MVC ...

Viewed 17274 times

13 Comments for this item

ASP.NET 5 By Numbers

Monday, March 16, 2015 1:20 PM

ASP.NET MVC ASP.NET Web Pages ASP.NET 5

There's a lot of confusion surrounding the numbers relating to the impending release of the next version of ASP.NET. This post takes a look at the main ones and seeks to explain their significance.

Click to read more about ASP.NET 5 By Numbers ...

Viewed 8323 times

3 Comments for this item

Recent Comments

Justin Kusuma 7/24/2015 3:38 AM
In response to Posting Data With jQuery AJAX In ASP.NET Razor Web Pages
Hi Mike, thanks much for sharing such an article :) Really help me a lot... further, I'd like to...

Michael Easterbrook 7/22/2015 5:35 PM
In response to Inline Razor Syntax Overview
I removed the @ symbols and I am still getting the same error. It only occurs when I have an "if" a...

Sujay 7/22/2015 1:36 PM
In response to ASP.NET MVC, Entity Framework, One-to-Many and Many-to-Many INSERTS
can you explain how to link two tables so that it forms many to many relationship?(Article and...

Max G 7/21/2015 9:29 PM
In response to Scheduled Tasks In ASP.NET With Quartz.Net
Hi, I've opted for this solution in one of my applications but i've found that the apppool is and I...

Michael Easterbrook 7/20/2015 4:31 PM
In response to Inline Razor Syntax Overview
When I have the following code: @foreach (var procRow in procRowDecade) { if (@procRow[3] +...

Shanice 7/18/2015 10:58 PM
In response to A Better Way To Export Gridviews To Excel
Hi. I'm working with mvc. I need to add the above code in the business logic layer, however the...

Matt 7/18/2015 6:29 PM
In response to Nested Layout Pages with Razor
Cheers sir, nice explanation :)...

Keshavan 7/17/2015 9:06 AM
In response to Scheduled Tasks In ASP.NET With Quartz.Net
Hi Mike, I have followed exactly as illustrated in blog, I get error "StdSchedulerFactory.cs" not...

Paul Thiel 7/16/2015 5:17 PM
In response to ASP.NET 5 By Numbers
Comments Below: "The new version of ASP.NET is called ASP.NET 5. It is a framework for developing...

saket singh 7/16/2015 8:42 AM
In response to Scheduled Tasks In ASP.NET With Quartz.Net
hi Mike, great tutorial on Quartz.net , but i have One Problem , Everything is working fine as as...