Latest Entries

ASP.NET 5 By Numbers

calendar_today 16 March 2015 13:20

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.

Error Handling in ASP.NET Razor Web Pages

calendar_today 10 March 2015 13:07

ASP.NET Web Pages WebMatrix

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?

ASP.NET MVC DropDownLists - Multiple Selection and Enum Support

calendar_today 03 March 2015 13:26

ASP.NET MVC

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.

Migrating From Razor Web Pages To ASP.NET MVC 5 - Model Binding And Forms

calendar_today 24 February 2015 14:51

ASP.NET MVC ASP.NET Web Pages

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.

Migrating From Razor Web Pages To ASP.NET MVC 5 - Data Access And View Models

calendar_today 18 February 2015 13:16

ASP.NET MVC Entity Framework ASP.NET Web Pages

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.

Migrating From Razor Web Pages To ASP.NET MVC 5 - Views and Controllers

calendar_today 16 February 2015 13:33

ASP.NET MVC ASP.NET Web Pages

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.

Integrating Web API with ASP.NET Razor Web Pages

calendar_today 03 February 2015 13:26

ASP.NET Web Pages WebMatrix Web API

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.

MVC 5 with EF 6 in Visual Basic - Working With Files

calendar_today 27 January 2015 13:26

VB.Net ASP.NET MVC

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.

ASP.NET MVC 5 with EF 6 - Working With Files

calendar_today 27 January 2015 13:19

ASP.NET MVC

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.

Usage of the @ (at) sign in ASP.NET

calendar_today 22 January 2015 13:54

C# ASP.NET MVC ASP.NET Web Pages Razor

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.

Entity Framework Recipe: Grouping By Year And Month

calendar_today 12 January 2015 20:38

ASP.NET MVC Entity Framework

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.

Entity Framework Recipe: Alphabetical Paging In ASP.NET MVC

calendar_today 29 October 2014 20:53

ASP.NET MVC Entity Framework

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.

Entity Framework Recipe: Hierarchical Data Management

calendar_today 24 October 2014 22:20

ASP.NET MVC Entity Framework

This article explores how to use Entity Framework 6 to manage the retrieval and display of hierarchical data such as you might find in a menu system. There are a number of existing items on the Internet that cover the same topic, but most of them seem unnecessarily complex and don't include any information about displaying the data once it has been retrieved.

Scheduled Tasks In ASP.NET With Quartz.Net

calendar_today 07 August 2014 08:34

General ASP.NET MVC ASP.NET Web Forms ASP.NET Web Pages

A perennial question on the ASP.NET forums concerns how to schedule regular tasks as part of a web application. Typically, the requirement is to send emails once every 24 hours at a particular time each day, but it could actually be anything from tweeting on a schedule to performing maintenance tasks. Equally typically, half a dozen members on the forum dive in with recommendations to install Windows Services or schedule batch files with the Task Scheduler - regardless of the fact that most web site owners are not afforded such privileges as part of their shared hosting plan.

Using ASP.NET Identity with Razor Web Pages

calendar_today 04 July 2014 07:27

ASP.NET Web Pages WebMatrix Razor

ASP.NET Identity is the new membership system for ASP.NET applications and is the recommended system for new MVC 5 and Web Forms projects. Among other things, it moves membership away from being dependent on System.Web, which is the general direction that the next version of ASP.NET is taking. News on how the Web Pages framework will be impacted by this evolution in ASP.NET is scarce at the moment, and so is information on how to incorporate ASP.NET Identity into a Razor Web Pages site. This article demonstrates the steps required to make use of the ASP.NET Identity framework in your Web Pages application.

MVC 5 with EF 6 in Visual Basic - Advanced Entity Framework Scenarios

calendar_today 13 June 2014 13:42

VB.Net ASP.NET MVC Entity Framework

This tutorial is the last in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. This final tutorial  introduces several topics that are useful to be aware of when you go beyond the basics of developing ASP.NET web applications that use Entity Framework Code First. Step-by-step instructions walk you through the code and using Visual Studio Express For Web for the following topics:

MVC 5 with EF 6 in Visual Basic - Implementing Inheritance

calendar_today 13 June 2014 13:42

VB.Net ASP.NET MVC Entity Framework

This tutorial is the eleventh in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In the previous tutorial you handled concurrency exceptions. This tutorial will show you how to implement inheritance in the data model.

MVC 5 with EF 6 in Visual Basic - Handling Concurrency

calendar_today 13 June 2014 13:41

VB.Net ASP.NET MVC Entity Framework

This tutorial is the tenth in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In earlier tutorials you learned how to update data. This tutorial shows how to handle conflicts when multiple users update the same entity at the same time. You'll change the web pages that work with the Department entity so that they handle concurrency errors.

MVC 5 with EF 6 in Visual Basic - Async and Stored Procedures with the Entity Framework

calendar_today 13 June 2014 13:40

VB.Net ASP.NET MVC Entity Framework

This tutorial is the ninth in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In earlier tutorials you learned how to read and update data using the synchronous programming model. In this tutorial you see how to implement the asynchronous programming model. Asynchronous code can help an application perform better because it makes better use of server resources.

MVC 5 with EF 6 in Visual Basic - Updating Related Data

calendar_today 13 June 2014 13:39

VB.Net ASP.NET MVC Entity Framework

This tutorial is the eighth in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In the previous tutorial you displayed related data; in this tutorial you'll update related data. For most relationships, this can be done by updating either foreign key fields or navigation properties. For many-to-many relationships, the Entity Framework doesn't expose the join table directly, so you add and remove entities to and from the appropriate navigation properties.