Latest Entries

Migrating Classic ASP To ASP.NET Razor Web Pages Part Two- Data Access

calendar_today 03 March 2014 13:26

Classic ASP VB.Net ASP.NET Web Pages WebMatrix

The first article in this series explored the differences (and similarities) between classic ASP inline syntax and Razor syntax, the templating technology behind ASP.NET Razor Web Pages. The work required so far to port intermixed HTML and simple conditional and selection statements across from classic ASP to Razor didn't require a lot of effort. That is about to change in this article as I look at data access.

Migrating Classic ASP To ASP.NET Razor Web Pages Part One- Razor Syntax And Visual Basic

calendar_today 24 February 2014 13:25

Classic ASP ASP.NET Web Pages WebMatrix Razor

You have a classic ASP application that needs migrating to ASP.NET. You are comfortable working with classic ASP. but ASP.NET is fairly new to you. So what do you do? This article is the first in a series that looks at your options and proposes an approach to the migration that follows the path of least resistance.

Creating Reusable Components For ASP.NET Razor Web Pages

calendar_today 04 February 2014 19:39

ASP.NET Web Pages WebMatrix

There are a number of ways that you can maximise code re-use within a Razor Web Pages site: Layout pages, helpers, functions and so on. As you build more sites, you soon find that you are repeating code between them. You might have a collection of custom utility functions and extension methods, for example that you find yourself copying and pasting across sites. Over time, this will become a maintenance nightmare as different versions of the methods live in different sites. This article shows how to solve that problem easily by creating a library that can be shared across multiple sites.

Adding a New Row In The Razor WebGrid

calendar_today 23 January 2014 08:10

ASP.NET Web Pages WebMatrix Razor WebGrid

The Razor WebGrid isn't just used for displaying data. I have already looked at how to edit data inline within the WebGrid, so this article looks at how to add new rows of data. within a rendered grid.

Request Validation In ASP.NET Web Pages

calendar_today 18 December 2013 11:24

ASP.NET Web Pages WebMatrix Razor

Cross Site Scripting (XSS) attacks are the third on the Open Web Application Security Project's (OWASP) 2013 list of security vulnerabilities. This article looks at the defence mechanisms built into ASP.NET that protect against such attacks and how you can disable those defences in ASP.NET Razor Web Pages in a safe manner when you need to.

Check Duplicate User Names In ASP.NET Web Pages Sites

calendar_today 29 November 2013 15:22

AJAX jQuery ASP.NET Web Pages WebMatrix Razor

The Web Pages Starter Site template provides a useful starting point for developing a Razor Web Pages site that includes membership. But it doesn't include any mechanism for preventing duplicate user names. This article offers one solution to the problem that uses jQuery.

Posting Data With jQuery AJAX In ASP.NET Razor Web Pages

calendar_today 06 November 2013 19:38

AJAX jQuery ASP.NET Web Pages WebMatrix Razor

There have been a few questions recently about what you can post to the server using jQuery AJAX and where to find whatever you posted. This article looks at using the jQuery ajax method in ASP.NET Razor Web Pages and explores how different options have different results.

Saving jQuery Sortables In ASP.NET Razor Web Pages

calendar_today 28 October 2013 20:04

jQuery ASP.NET Web Pages WebMatrix Razor

jQuery Sortables offer a way to specify the order of a collection of items through an easy drag and drop interface. I have just been working on the next release of Web Pages CMS and am in the process of implementing Sortables for managing the display order of menu items. This article looks at how they can be used in Razor Web Pages and shows one way of saving the resulting order to a database.

Managing Checkboxes And Radios In ASP.NET Razor Web Pages

calendar_today 14 October 2013 21:04

ASP.NET Web Pages WebMatrix Razor

Checkboxes and radio buttons cause more confusion than any other form control in ASP.NET Razor Web Pages. This article takes an in depth look at them and tackles the most frequently asked questions that they generate.

Code First Migrations With ASP.NET Web Pages Sites

calendar_today 28 August 2013 20:14

Visual Studio Entity Framework ASP.NET Web Pages WebMatrix

Entity Framework Code First Migrations enable changes to your model to be propagated to your database through code. Prior to the introduction of migrations, changes to the model resulted in the database being recreated from scratch with attendant loss of data. During development, this may not cause too many problems, but once the database has been deployed into production, it's another story. Migrations solve the problem in that changes are applied to the database schema without loss of data.

Windows Authentication With ASP.NET Web Pages

calendar_today 07 August 2013 19:34

ASP.NET Web Pages WebMatrix

The default authentication mechanism built into ASP.NET Web Pages site templates is Forms Authentication via the SimpleMembershipProvider, which is designed to enable authentication of users against a database. This requires the user to know their user name and password, and to enter those whenever they want to log in to access restricted areas within a site. If you are using the ASP.NET Web Pages framework to build an Intranet site that will be hosted within your own corporate network (i.e. client machines and web server are in the same domain), you can use Integrated Windows Authentication instead which simplifies authentication dramatically.

Implementing Customers Also Bought In ASP.NET Web Pages

calendar_today 01 August 2013 15:32

ASP.NET Web Pages WebMatrix Razor

Most successful e-commerce sites implement a mechanism that draws the customer's attention to other products that might be of interest to them. These products are selected on the basis that shoppers who purchased the item currently being viewed by the customer also bought other products. This article looks at a away of implementing this kind of facility in an ASP.NET Web Pages site.

How To Check If A Query Returns Data In ASP.NET Web Pages

calendar_today 03 July 2013 14:01

ASP.NET Web Pages WebMatrix Razor

If you execute a query against a database, you need to know if any data was returned. But what is the best way to test for the presence of data when using the Web Pages Database helper?

Web Pages CMS Launched

calendar_today 07 June 2013 14:55

ASP.NET Web Pages WebMatrix

Earlier this week, I released the first version of Web Pages CMS - a content managment system that has been built using the ASP.NET Web Pages framework. The project is being hosted at CodePlex, and version is available as a download. I also launched an accompanying web site that provides documentation for the project at

A CKEditor File Browser For ASP.NET Web Pages

calendar_today 16 May 2013 14:00

ASP.NET Web Pages WebMatrix Razor

CKEditor is one of the most popular rich text editors available. Out of the box, there is no file browser to help with selecting images, but you can purchase an add-on from them - CKFinder. Alternatively, you can build your own file browser component.

Adding A Footer To The Razor WebGrid

calendar_today 25 February 2013 19:43

ASP.NET Web Pages WebMatrix Razor WebGrid

Whether you are using the Razor WebGrid in an ASP.NET Web Pages site, or an MVC application, you may well want to display tabular data at some point in which case you are likely to turn to the Razor WebGrid helper. And if you want to do that, you might also want to add a footer to the rendered table. Here are some ways that you can accomplish that task.

Razor Web Pages E-Commerce - Adding A Shopping Cart To The Bakery Template Site

calendar_today 15 February 2013 19:31

ASP.NET Web Pages WebMatrix Razor

The ASP.NET Web Pages Bakery template site is designed as a starting point for a site that displays products. It also features an order form for customers to specify a quantity for a specific product and provide their shipping address. The site doesn't provide for multiple product selection. If you want a shopping cart for the Bakery site, you need to create it yourself. This article looks at the design considerations behind an effective shopping cart, and shows how to build one.

Consuming Feeds And Web Services In Razor Web Pages

calendar_today 05 February 2013 19:55

ASP.NET Web Pages WebMatrix

Increasing numbers of businesses are making services and data available to third parties via Web Services or feeds. Data format and protocols can vary significantly across service providers, so here is a look at how to manage the consumption of a number of popular formats delivered through REST and SOAP services within a web site built using the ASP.NET Web Pages framework.

Practical Recursion in ASP.NET Web Pages with WebMatrix

calendar_today 22 January 2013 14:44

ASP.NET Web Pages WebMatrix Razor

Recursive methods are those that call themselves, and they can be applied to solve a number of common practical problems, particularly ones that involve the management and display of hierarchical data. This article explores some of those scenarios and shows how to design recursive helpers and functions that can be used in Web Pages sites.

Exporting The Razor WebGrid To Excel Using OleDb

calendar_today 07 January 2013 20:38

ASP.NET Web Pages WebMatrix WebGrid

This article looks at how you can provide your users with the ability to export the contents of a Razor Web Pages WebGrid to an Excel file using OleDb.