A collection of articles and tutorials on web development with ASP.NET by Mike Brind

Latest Entries

Customising Identity in Razor Pages

22 September 2017 14:16

ASP.NET Core Razor Pages ASP.NET Identity

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.

Click to read more about Customising Identity in Razor Pages ...

Viewed 1069 times

0 Comments for this item

Introduction to Identity in Razor Pages

08 September 2017 08:09

ASP.NET Core Razor Pages ASP.NET Identity

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.

Click to read more about Introduction to Identity in Razor Pages ...

Viewed 1548 times

0 Comments for this item

Sending Email in Razor Pages

20 July 2017 07:24

ASP.NET Core Razor Pages

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.

Click to read more about Sending Email in Razor Pages ...

Viewed 2153 times

5 Comments for this item

Routing in Razor Pages

11 July 2017 13:28

ASP.NET Core Razor Pages

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.

Click to read more about Routing in Razor Pages ...

Viewed 4205 times

4 Comments for this item

Razor Pages - The Elevator Pitch

25 May 2017 08:29

ASP.NET MVC ASP.NET Core Razor Pages

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.

Click to read more about Razor Pages - The Elevator Pitch ...

Viewed 4612 times

8 Comments for this item

Razor Pages - Understanding Handler Methods

22 May 2017 20:16

ASP.NET Core Razor Pages

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.

Click to read more about Razor Pages - Understanding Handler Methods ...

Viewed 3485 times

2 Comments for this item

Razor Pages - Getting Started With The Preview

15 May 2017 20:52

Razor ASP.NET Core Razor Pages

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.

Click to read more about Razor Pages - Getting Started With The Preview ...

Viewed 4097 times

6 Comments for this item

Working With Zip Files In ASP.NET MVC

10 February 2017 07:41

ASP.NET MVC

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.

Click to read more about Working With Zip Files In ASP.NET MVC ...

Viewed 5419 times

2 Comments for this item

Free SSL Certificates On IIS With LetsEncrypt

02 February 2017 07:44

ASP.NET MVC ASP.NET Web Forms ASP.NET Core

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.

Click to read more about Free SSL Certificates On IIS With LetsEncrypt ...

Viewed 3763 times

5 Comments for this item

Entity Framework Core DbContext Updated

28 October 2016 08:50

Entity Framework ASP.NET Core

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.

Click to read more about Entity Framework Core DbContext Updated ...

Viewed 3962 times

1 Comment for this item

Entity Framework Core TrackGraph For Disconnected Data

11 October 2016 21:40

Entity Framework ASP.NET Core

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.

Click to read more about Entity Framework Core TrackGraph For Disconnected Data ...

Viewed 4131 times

2 Comments for this item

Server.MapPath Equivalent in ASP.NET Core

02 September 2016 14:55

ASP.NET Core

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?

Click to read more about Server.MapPath Equivalent in ASP.NET Core ...

Viewed 22838 times

2 Comments for this item

Loading ASP.NET Core MVC Views From A Database Or Other Location

21 July 2016 08:56

ASP.NET MVC ASP.NET Core

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.

Click to read more about Loading ASP.NET Core MVC Views From A Database Or Other Location ...

Viewed 7560 times

7 Comments for this item

ASP.NET Web Pages vNext or Razor Pages

15 July 2016 14:09

ASP.NET MVC ASP.NET Web Pages ASP.NET Core Razor Pages

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.

Click to read more about ASP.NET Web Pages vNext or Razor Pages ...

Viewed 5673 times

15 Comments for this item

Entity Framework Code First and Stored Procedures

16 June 2016 07:38

Entity Framework

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.

Click to read more about Entity Framework Code First and Stored Procedures ...

Viewed 66577 times

3 Comments for this item

Recent Comments

Pam 30/08/2017 11:30
In response to Sending Email in Razor Pages
Mike, RazorPages sound like a nice choice for somebody still working in ASP classic who wants to to...

Robby Robson 15/08/2017 00:43
In response to Routing in Razor Pages
Mike: great stuff. Now that .Core Standard 2.0 is formally out, how soon will you rewrite your book...

Satyabrata Mohapatra 28/07/2017 08:59
In response to Sending Email in Razor Pages
Bit off topic, but congratulation sir for your MVP award. You deserve it !!!...

Satyabrata Mohapatra 23/07/2017 16:43
In response to Razor Pages - The Elevator Pitch
@Dale Severin You can continue to build apps using asp.net web pages....

Satyabrata Mohapatra 23/07/2017 16:40
In response to Sending Email in Razor Pages
Thanks for sharing...learned a lot...

Gfw 22/07/2017 11:53
In response to Sending Email in Razor Pages
Question... Does System.Net.Mail support SSL?...

Dale Severin 20/07/2017 03:38
In response to Razor Pages - The Elevator Pitch
I work with razor web pages extensively. I appreciate the rapid development it permits me to I am as...

Obinna Okafor 14/07/2017 01:19
In response to Routing in Razor Pages
Thank you, Mike. Good post....

Satyabrata Mohapatra 11/07/2017 16:02
In response to Routing in Razor Pages
Very powerful routing system!!...

Cyrus 05/07/2017 03:41
In response to Razor Pages - Getting Started With The Preview
How can I trim packages and services as much as possible to use just razor pages? I don’t want to to...