Skip to content
janjongboom edited this page Aug 28, 2011 · 6 revisions

1a. Installing Moth via NuGet

See NuGet gallery: Moth.

1b. Installing Moth (manual)

Download the Moth source, and run the '/Build/build.bat' script. Add the DLL that is generated in the Output directory to your project.

2. Registering in Global.asax

On top of the RegisterRoutes method, add the following line:

MothRouteFactory.RegisterRoutes(RouteTable.Routes);

If using MVC 3, add the following line to the RegisterGlobalFilters method:

// to make sure that Moth can post-process all requests, add a global filter
// this doesn't enable output caching by default, so no danger
filters.Add(new MothAction());

3. MVC 2 only: Add to controller

As MVC 2 doesn't support global filters, you will have to add the following attribute to every controller in your project. You can also create a BaseController that has this attribute, and let all the other controllers inherit from this base class:

[MothAction]
public class SomeController : Controller

4. MVC 3 Razor only: Register in the web.config

To add support for the Moth methods in your views, add the following line to your Views/Web.config, under the \\system.web.webPages.razor\pages\namespaces section:

<add namespace="Moth.Core"/>

5. Explore posibilities!

A list of Moth features, can be found here: Home.