PageMethods allows to enforce strong typing when calling a web pages, and provides an intuitive navigation model when coding web applications.

Linking to a web page is very easy, both in simple HTML and in ASP.NET. Linking to a page that really exists, passing the right parameters, and parsing these parameters, is a bit different.

Introduction

The problem

Let's take a simple example. You want to call a page that displays information about a customer. The page expects a customer ID. Let's say that ID is an integer.

Here is how a URL to call such a page would look like: http://myserver/Customer.aspx?CustID=12

If you're not the developer who created the page, how do you know the name of the parameter? How do you know the type of this parameter?
Either you have to look deep in the code of the page you want to invoke (do you always have that code at hand, by the way? Not so sure), or you look in the documentation related to that page (does such documentation exist? Is this documentation up-to-date? Did Joe update the documentation when he quickly renamed the parameter from CustID to CustomerID?).

This gives you an idea about the limitations coming with the default way of linking or redirecting to a page. But let me give you some more insight about other limitations:
  • you refer to a page by its file name (no check at compile time, so if you make a mistake, you'll know only when someone tries to access the page. This means that you're never sure what you deliver is 100% safe. When you realize you've made a mistake, it's late and you have to redeploy the application after fixing the problem)
  • you never know for sure what parameters or combinations of parameters each page expects
  • you have to know the exact name of each parameter
  • you pass parameters by concatenation of strings (this is work, code is not easy to read, and not nice)
  • you have to parse and convert parameters by yourself (in ASP.NET, parameters passed on URLs are available through Request.QueryString, only as strings)
  • a page must validate the parameters it receives (Check parameters are not null. Is the type of each parameter correct? Are the parameters within the range of valid values?)

The solution

PageMethods takes care of your URLs. It proposes a solution to define structured URLs for each of your pages, as well as a clean and simple way to call them.

The idea is based on strict page inputs and declarative parameter binding. With PageMethods, each page exposes a set of methods that represent the different ways to call the page.
All you have to do to start benefiting from sharp URLs is to add methods to your pages, and mark these methods with attributes provided by PageMethods.

Project's status

The PageMethods project is currently in transition mode.
We have just opened this space on CodePlex. The source code is currently available to developers only. A public release will be made available once everything is setup correctly here and when the new developers have joined the project. If you want to join this project, please contact us.
In the meantime, you can get the latest versions and complete information from the usual place on PageMethods's home page (http://metaSapiens.com/PageMethods).

Last edited Feb 22, 2007 at 1:01 AM by fabrice, version 4