calendar_today 14 April 2016 13:42
I've seen a lot of questions about the best way to import data from uploaded Excel files to a SQL Server database in an ASP.NET application. Most solutions involve the use of the JET or ACE OLEDB providers to read data from the saved Excel file, and some even show how to use Office Interop to obtain the data. However, all of these solutions rely on additional components being installed on the server, and they also require the uploaded file to be saved somewhere, even temporarily, which creates an additional maintenance task. The solution that follows makes use of a Nuget package that gets deployed with your application and can work with streams, so the uploaded file doesn't need to be saved. It is, in my submission, THE best way to import data from uploaded Excel files to SQL Server in an ASP.NET application.
calendar_today 30 March 2016 19:21
Prefix is a free profiler for ASP.NET applications. It's dead easy to use and it will help you find bugs in your code that you didn't even know you had. I found two in what I thought were properly working apps within an hour of downloading Prefix.
calendar_today 01 March 2016 13:15
The ASP.NET Core framework provides a new API for protecting data, including mechanisms for encryption and decryption. This article takes a quick look at how they can be used.
calendar_today 12 February 2016 08:45
The ASP.NET Core MVC framework (previously known as MVC 6) includes a new feature called View Components. Here, I take a look at them, the kind of problems they are designed to solve and how to use them.
calendar_today 26 January 2016 07:39
A couple of threads have been posted recently to the ASP.NET forums complaining that values posted to ASPX files are mysteriously disappearing. This post looks at the most likely cause and provides some solutions.
calendar_today 11 January 2016 13:14
This article looks at the steps required to enable SQL Server as a backing store for Session State in an ASP.NET Core 1.0 MVC application. It builds on my previous article which introduces how to configure and use session state in ASP.NET 5.
calendar_today 16 December 2015 07:37
This is the last in a series of articles that explore how to optimise ASP.NET web sites for search engines. Each article in the series concentrates on a specific topic and looks at the features and tools available to ASP.NET developers to help make sites search engine friendly and thereby improve rankings and click throughs from search results. This article explores how to ensure that search engines are aware of all of the content you want them to crawl and how to inform them when the location of that content is no longer valid.
calendar_today 07 December 2015 08:57
This is the second in a series of articles that explore how to optimise ASP.NET web sites for search engines. Each article in the series concentrates on a specific topic and looks at the features and tools available to ASP.NET developers to help make sites search engine friendly and thereby improve rankings and click throughs from search results. This article will looks at some best practices concerning your site's URLs and how to make them more user friendly for search engines and humans alike.
calendar_today 01 December 2015 07:53
This is the first in a series of articles that explore how to optimise ASP.NET web sites for search engines. Each article in the series concentrates on a specific topic and looks at the features and tools available to ASP.NET developers to help make sites search engine friendly and thereby improve rankings and click-throughs from search results. This first article will look at how to present your site content to search engines in the most optimal way.
calendar_today 27 October 2015 13:58
Handling file uploads has changed quite a bit in ASP.NET Core. This article looks at the new objects that have been introduced to replace the old System.Web based approach from previous versions of ASP.NET. **Updated to RTM**
calendar_today 19 October 2015 21:09
I have looked at uploading individual files and downloading multiple files in MVC, and I've had a few requests recently asking me to complete the series by showing how to upload multiple files in an ASP.NET MVC application.
calendar_today 09 October 2015 08:53
This short article examines the baffling issue that a lot of people seem to encounter when attempting to send multiple files to the client from an ASP.NET application, and provides the solution.
calendar_today 24 September 2015 08:05
This is the fourth in a series of articles that explores ASP.NET Core by reconstructing the Visual Studio 2015 Web Application template from an Empty template. This article looks at the role of services and the new ASP.NET Core dependency injection system. The series of articles has been developed using Visual Studio RTM and ASP.NET Core Beta 6. It will be kept updated along with newer releases.
calendar_today 04 September 2015 09:32
This is the third in a series of articles that explores ASP.NET 5 by reconstructing the Visual Studio 2015 Web Application template from an Empty template. This article looks at the new configuration system added to ASP.NET 5 and will also cover how services like Entity Framework and MVC itself are added to the project. The series of articles has been developed using Visual Studio RTM and ASP.NET 5 Beta 6. It will be kept updated along with newer releases.
calendar_today 13 August 2015 21:05
This is the second in a series of articles that explores what's new in ASP.NET 5 by starting with the Visual Studio 2015 Empty site template and progressively adding files to emulate the Web Application template contents and structure. While not actually part of the ASP.NET 5 framework, this article explores the recommended tools for managing client-side dependencies: NPM, Bower and Gulp. These tools are very popular among front-end developers working with other frameworks and now that they have been integrated as first class citizens in Visual Studio 2015, their use is encouraged among .NET developers. The series of articles has been developed using Visual Studio 2015 and ASP.NET 5 Beta 6. It will be kept updated along with newer releases.
calendar_today 04 August 2015 13:20
When you create a new ASP.NET web application using the Web Application template, you are presented with a raft of new folders and files in a completely new structure. This article is the first in a series that attempts to demystify the new structure and the role that some of these files play. The article series starts with the Empty template and adds the various files that you might see in the web application template progressively to illustrate their purpose. This article uses Visual Studio 2105 RTM and ASP.NET 5 Beta 6. It will be updated in line with future releases.
calendar_today 29 July 2015 21:56
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.
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.
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.