Latest Entries
Razor Pages - Getting Started With The Preview
calendar_today 15 May 2017 20:52
Current users of ASP.NET Web Pages have been eagerly awaiting news on what ASP.NET Core holds for them (if my inbox is anything to go by). The roadmap suggested that a new version of Web Pages would be forthcoming after the initial release of .NET Core, but that item was subsequently removed. Instead, a new cross platform page-centric web development model called Razor Pages has been made available in preview form. Here, I show you how to get started with it and explore its similarities with Web Pages. In future articles, I will take a closer look at the wide range of differences.
Working With Zip Files In ASP.NET MVC
calendar_today 10 February 2017 07:41
Since ASP.NET 4.5, zipping and unzipping files can be done with classes from within the .NET framework. Despite that, nearly all examples that illustrate working with zip files in ASP.NET applications feature third party open source compression libraries. This short article attempts to correct that by demonstrating the use of the System.IO.Compression classes to unpack an uploaded zip file, and to create one for download in an ASP.NET MVC application.
Free SSL Certificates On IIS With LetsEncrypt
calendar_today 02 February 2017 07:44
If you have forms on your site that take a user's personal details, you should protect the page by running it under HTTPS. That way, any data that's posted from the form (email address, credit card number etc) is encrypted and hidden from prying eyes. It's not just e-commerce sites that should be protected. Intranets and other line of business apps that require authentication, blogs with comment forms that ask for email addresses and so on. The main barrier to this in the past has been the cost of the digital certificate (SSL Certificate) that asserts that you are who you say you are. LetsEncrypt is a free, automated, and open Certificate Authority that removes this barrier.
Entity Framework Core DbContext Updated
calendar_today 28 October 2016 08:50
Redesigning a framework from the ground up provides an opportunity to implement an improved API. The team working on Entity Framework Core have certainly grabbed that opportunity in respect of the DbContext class, which sees a bunch of new data manipulation methods not available in Entity Framework 6 or earlier.
Entity Framework Core TrackGraph For Disconnected Data
calendar_today 11 October 2016 21:40
Entity Framework Core is the new lightweight version of Entity Framework designed to work with .NET Core applications. Just like ASP.NET Core, it has been rewritten from the ground up, and includes some new ways of doing things. One of those is the introduction of the TrackGraph method for handling complex data in disconnected scenarios such as MVC or Web API applications.
Server.MapPath Equivalent in ASP.NET Core
calendar_today 02 September 2016 14:55
Web Developers who use Microsoft technologies have always relied on the Server.MapPath method to resolve file paths in classic ASP and ASP.NET Web Forms and MVC versions up to and including 5. This method has not been included in ASP.NET Core, so what do you use instead?
Loading ASP.NET Core MVC Views From A Database Or Other Location
calendar_today 21 July 2016 08:56
For the vast majority of ASP.NET Core MVC applications, the conventional method of locating and loading views from the file system does the job nicely. But you can also load views from other sources including a database. This is useful in scenarios where you want to give users the option to craft or modify Razor files but don't want to give them access to the file system. This article looks at the work required to create a component to obtain views from other sources, using the database as a working example.
ASP.NET Web Pages vNext or Razor Pages
calendar_today 15 July 2016 14:09
Now that the RTM of ASP.NET Core has shipped, the ASP.NET team are looking at the features that were left behind including SignalR and Web Pages. The ASP.NET Core road map always had those items scheduled for inclusion in the first major release after RTM, which will be ASP.NET Core 1.1. Recently, the ASP.NET Team provided an update on GitHub on the goals driving the next version of Web Pages which provides an interesting insight into the potential features of the framework.
Entity Framework Code First and Stored Procedures
calendar_today 16 June 2016 07:38
A key reason behind the decision to use an ORM such as Entity Framework for your data access is to reduce or eliminate the need to write SQL as part of the development process. Nevertheless, there are times when you might need to make use of database stored procedures, and Entity Framework 6 Code First provides support for using existing stored procedures as well as generating new ones.
Implementing SQL Server Full-Text Search In An ASP.NET MVC Web Application With Entity Framework
calendar_today 13 May 2016 08:13
The search facility on this site has been rudimentary at best. I have recently upgraded it to take advantage of the Full-Text Search feature in SQL Server. Although it is still a basic implementation, it is a vast improvement on the search system that existed before, which was based on Entity Framework dynamically generating SQL LIKE clauses. This article describes how I got SQL Server Full-Text Search up and running.
The Best Way To Import Data From Excel To SQL Server via ASP.NET
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.
Exploring Prefix: A Free ASP.NET Profiling Tool
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.
Encryption and Decryption in ASP.NET Core
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.
View Components in ASP.NET Core MVC
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.
Request.Form Is Empty When Posting To ASPX Page
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.
Configuring SQL Server For Session State In ASP.NET Core 1.0 MVC
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.
SEO For ASP.NET Web Sites: Getting content indexed
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.
SEO For ASP.NET Web Sites: URLs
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.
SEO For ASP.NET Web Sites: Content
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.
Uploading files with ASP.NET Core 1.0 MVC
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**