calendar_today 18 May 2015 13:45
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.
calendar_today 11 May 2015 13:17
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.
calendar_today 30 April 2015 13:26
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.
calendar_today 23 April 2015 13:19
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.
calendar_today 14 April 2015 13:25
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
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.
calendar_today 07 April 2015 13:39
ASP.NET Core 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 Core applications.
calendar_today 31 March 2015 13:22
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.
calendar_today 24 March 2015 13:21
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.
calendar_today 16 March 2015 13:20
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.
calendar_today 10 March 2015 13:07
Bang! An unhandled exception occurred during the execution of the current web request. And that's it - your visitor is met with the yellow screen of death and they are left wondering what they did wrong. You might not even be aware of what's just happened - unless your visitor can find some way of alerting you, oh, and they bother to do so. That's the problem with run time errors; the code worked fine when you ran it on your machine. But then along came a user and they tried to do something you didn't anticipate and broke your site. So what should you do about this?
calendar_today 03 March 2015 13:26
My original article about Drop Down Lists in ASP.NET MVC has proven to be among the most popular on this site, amassing over a third of a million views since it was published 5 years ago. This article builds on the original by looking at using drop down lists for multiple selections, and the helper that was introduced in MVC 5.1 to support enumerations as a source of select options.
calendar_today 24 February 2015 14:51
If you have built sites with the ASP.NET Razor Web Pages framework, you might want to look at migrating them to ASP.NET MVC at some point. This tutorial is the last in a series of three that explores how you do that by taking a step by step approach to migrating the WebMatrix Bakery template site to ASP.NET MVC 5. Previous tutorials in the series have looked at the roles of the View and Controller, and the data access and view model aspects of the Model. This final part covers model binding and form posting. A download (c. 24MB) featuring the completed application is available on GitHub.
calendar_today 18 February 2015 13:16
If you have built sites with the ASP.NET Razor Web Pages framework, you might want to look at migrating them to ASP.NET MVC at some point. This tutorial is the second in a series of three that explores how you do that by taking a step by step approach to migrating the WebMatrix Bakery template site to ASP.NET MVC 5. Along the way, each of the core parts of MVC are discussed by way of an introduction to the framework. The tutorial is divided into three parts. The first part looked at the roles of the View and Controller. This part looks at the M in MVC, the Model. Specifically, it features data access and view models. The final part will cover model binding and form posting. A download (c. 24MB) featuring the completed application is available on GitHub.
calendar_today 16 February 2015 13:33
If you have built sites with the ASP.NET Razor Web Pages framework, you might want to look at migrating them to ASP.NET MVC at some point. This tutorial is the first in a series of three that explores how you do that by taking a step by step approach to migrating the WebMatrix Bakery template site to ASP.NET MVC 5. Along the way, each of the core parts of MVC will be discussed by way of an introduction to the framework. The tutorial is divided into three parts. This first part looks at the V and C part of MVC - View and Controller. The M or Model is covered in the second and third parts. A download (c. 24MB) featuring the completed application is available on GitHub.
calendar_today 03 February 2015 13:26
ASP.NET Web API is the recommended way to build RESTful services over HTTP when using the ASP.NET stack. This article looks at incorporating Web API into an existing Razor Web Pages site, and provides a brief introduction to Web API itself.
calendar_today 27 January 2015 13:26
This tutorial explores how to upload files in an ASP.NET MVC applications and how to use Entity Framework to store them in a database. It builds on a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. This tutorial does not have a counterpart in the original tutorial series, produced by Tom Dykstra and Rick Anderson ( @RickAndMSFT ) which was written using the C# language. A C# version is available here.
calendar_today 27 January 2015 13:19
This tutorial explores how to upload files in an ASP.NET MVC application and how to use Entity Framework to store them in a database. It builds on a series of 12 featuring the fictitious Contoso University that teach you how to build MVC 5 applications using Entity Framework for data access. The original tutorial series was produced in C# by Tom Dykstra and Rick Anderson ( @RickAndMSFT ) of Microsoft. This tutorial is coded in C#. As with the previous tutorials, I have produced a version that uses the Visual Basic language. It is available here.
calendar_today 22 January 2015 13:54
The number of places where you might use or encounter the
@ sign in ASP.NET has grown over the last few years and its exact purpose in all circumstances still seems to cause confusion. Here's an overview of the most common places that it crops up, and guidance on its correct usage.
calendar_today 12 January 2015 20:38
This is the latest in a series of "EF Recipes" - short articles that show through practical examples how to achieve common tasks with Entity framework and ASP.NET MVC. This particular example looks at grouping data by year and month in MVC 5 with Entity Framework 6. The article is prompted by an email I got from a reader who asked how I generate the "Archives" feature in the right hand panel on each page on this site.
calendar_today 29 October 2014 20:53
This article looks at using the alphabet for paging data in MVC 5 with Entity Framework 6. Where it differs from most existing articles on alphabetical paging is that this article looks at generating paging links from the data instead of the alphabet. It also features a Bootstrap-friendly helper for generating the paging links.