共用方式為


PageMethods: Well-defined URLs for your ASP.NET sites and applications

Via Fabrice

PageMethods for Visual Studio 2005 has just been released. This version offers the same support as the version for VS 2003, plus some additional features.
PageMethods proposes a new code model that enables well-defined URLs and simplifies working with hyperlinks for your ASP.NET sites and applications.

PageMethods enables reliable URLs.
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.
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, reliable URLs is to add methods to your pages, and mark these methods with attributes provided by PageMethods.

Here is how you would declare a page method:

[PageMethod]
protected void DisplayCustomer(int customerID)
{
...
}

Here is how you would refer to the page declaring this method:

MyHyperLink.NavigateUrl = MyPageMethods.Customers.CustomerPage.DisplayCustomer(1234);

 

Check out: https://metaSapiens.com/PageMethods