Search Wiki:
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
Comments
evilz wrote  Nov 16 2007 at 3:27 PM  
Hi,

I just want to say that this is one of the greatest project for ASP.net I have ever seen !

I think it's easy to get this for HttpHandler ?

And that's very good it's now open source project !!!

Thank

fabrice wrote  Nov 29 2007 at 5:23 PM  
Hi,

I'm glad you like PageMethods.
It already works with HTTP handlers. The support is not packaged in a release yet, but is available in the source code. See http://www.codeplex.com/PageMethods/SourceControl/ListDownloadableCommits.aspx
I plan to post a new release that includes this feature soon. Feel free to rebuild the source code in the meantime.

Fabrice

cnlangzi wrote  Apr 28 at 3:42 AM  
I am glad that PageMethods has becomed open source.
I want to join you.And I think we should to upgrage it to support vs2008.

fabrice wrote  May 12 at 5:34 PM  
Thank you for your interest in joining the project. I'll contact you by email shortly.
Regarding VS 2008, support is already available. It's not included in a release yet, but the version for VS 2005 works with VS 2008.
All that is needed is to register the PageMethods add-in and code generator for VS 2008. This has been included in the source code.
See the latest change set and the *VS2008.reg files in Source/PageMethods2005/Setup.

Fabrice

Updating...