ProMesh.NET Quick Walkthrough - Part 6 - Executing other methods
So far we have seen classes having a Run() method and where the URL page name was mapped to the class name. This is how I use ProMesh.NET in most cases, but there are 3 ways of defining and calling controllers.
1. Class name is page name, default Run() methodThe class name is deduced from the page specified in the URL, and the Run() method is automatically called for the class:
http://www.yoursite.com/MyPage.ashx
The class should be named MyPage and should have a Run() method:
public class MyPage : PageController
{
public void Run() // Mapped to MyPage.ashx
{
}
}
2. Page name mapped to the class name, a custom method can be calledhttp://www.yoursite.com/MyPage.ashx/MyMethod
The class should be named MyPage and should have a method MyMethod()
public class MyPage : PageController
{
public void MyMethod() // Mapped to MyPage.ashx/MyMethod
{
}
}
3. Page name mapped to the method name, class name mapped to a folder (as in MonoRail)
http://www.yoursite.com/MyController/MyMethod.ashx
The class should be named MyController and should have a method MyMethod()
public class MyController : PageController
{
public void MyMethod() // Mapped to MyController/MyMethod.ashx
{
}
}
Next >>
Rendering views at runtime