calendar_today 07 September 2018 15:57
Updating portions of a page using AJAX and partial views is a routine task in ASP.NET MVC applications. The experience is little different in ASP.NET Core Razor Pages - not much, but enough to stump some people. Here is some advice on accomplishing this task, and a preview of some additional help coming in the near future.
calendar_today 03 September 2018 08:01
Support for Areas was added to Razor Pages with the release of ASP.NET Core 2.1. They have long been used in MVC applications as a way to separate logical chunks of large applications into semi-independent modules to facilitate team working etc. Here, I explore how to use areas in a Razor Pages application.
calendar_today 29 August 2018 08:23
Support for filters was added to Razor Pages with the release of ASP.NET Core
2.1. Filters, for those unfamiliar with them, are components that enable the
injection of processing at certain points within the Razor Page lifecycle.
They differ from Middleware in that they provide access to the
Razor Pages offers
a number of different filter options. One
of the things that you might want to do in a filter is to obtain data from an
external resource (database, web service etc) and then use it in the
PageModel or ViewData. Here, I take a look at how you can access the model or
ViewData dictionary depending on the type of filter implementation that you choose.
calendar_today 15 August 2018 13:46
Query Types, introduced in Entity Framework Core 2.1 enable you to return non-entity types that map to tables or views and can serve as the return type from FromSql method calls.
calendar_today 16 July 2018 07:54
In this article, I look at the steps required to get TypeScript up and running in the context of a Razor Pages application. I discuss why you might want to do this, and I use Knockout for the purposes of demonstration. By the end of the article, I will have configured and used TypeScript to replicate part of the final code for the Single Page Application tutorial from learn.knockout.com.
calendar_today 05 July 2018 13:27
In my last article, I looked at the experimental Blazor framework, using Cascading Dropdown Lists as an entry point. Since then, some feedback from Steve Sanderson to a question I asked has shown me a better way to implement this pattern.
calendar_today 24 May 2018 20:51
calendar_today 21 May 2018 13:49
UI generation and processing within web applications is moving increasingly to the client. Data processing and storage is still undertaken on the server, with JSON being the preferred format for exchanging data between the server and the client. There are a number of ways in which you can generate JSON when working with Razor Pages. This article explores some of them.
calendar_today 26 March 2018 08:50
Most migrations that you execute when working with Entity Framework Core are likely to be straightforward - resulting in nothing more than an adjustment to the database schema. Sometimes, however, you might also want to include a task that requires longer than the default command timeout value (30 seconds in SQL Server) such as importing a lot of data.
calendar_today 22 March 2018 08:15
I have just completed an article covering publishing a Razor Pages application to IIS on my Razor Pages dedicated site: learnrazorpages.com. While writing it (and publishing revised versions of the site) I uncovered a few stumbling blocks that might catch others out. So I thought they were worth highlighting here in their own post.
calendar_today 14 February 2018 08:13
The Razor Pages PageModel class is part controller, part ViewModel. In this article, I take a look at the ViewModel part of the role that the PageModel plays, and how tools like AutoMapper can be used to reduce the amount of code you need to write when assigning values between your entity model and your ViewModel.
calendar_today 19 January 2018 08:47
That's right - despite a number of questions, I am not writing a book on Razor Pages, the new page-based web development framework released as part of ASP.NET Core 2.0. But I have launched a web site for people who want to learn how to use ASP.NET Core Razor Pages.
calendar_today 22 September 2017 14:16
The code for managing authentication in a Razor Pages application that is provided by the standard project template is a good starting point. However, chances are that you want to customise it to fit your own application needs. This article looks at the most common customisation requirements.
calendar_today 08 September 2017 08:09
Razor Pages uses ASP.NET Identity as its default membership and authentication system. This article is the first in a series that explores the various parts of ASP.NET Identity as it relates to Razor Pages, and starts with an overview of the files generated as part of the project templates.
calendar_today 20 July 2017 07:24
The Razor Pages framework is not the only thing to be introduced as part of .NET Core 2.0. A lot more of the existing full framework class libraries are also being ported across to .NET Core including System.Net.Mail. That means there is no longer any need to rely on third party libraries or services for email functionality in your .NET Core applications. So I thought I'd take the opportunity to illustrate sending email in a Razor Pages application.
calendar_today 11 July 2017 13:28
One of the top level design considerations for the developers of a server-side web application framework is how to match URLs to resources on the server so that the correct one processes the request. The most straightforward approach is to map URLs to physical files on disk, and this is the approach that has been implemented by the ASP.NET team for the Razor Pages framework.
calendar_today 25 May 2017 08:29
In the last ASP.NET Community Standup, Jon Galloway gave my introductory Razor Pages article a shout out (thank you, Jon). During the discussion that ensued, Scott Hanselman asked for the "elevator pitch" for Razor Pages. Well, here's mine.
calendar_today 22 May 2017 20:16
Handler methods is a particularly nice feature introduced with the new ASP.NET Razor Pages framework . This feature enables you to determine what the user was doing when they requested the page, and to execute logic accordingly without having to resort to a bunch of conditional code.
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.
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.