Skip to content

Collection of simple pieces of reusable code (for ASP.NET MVC) designed such that dependencies aren't forced upon consumers of its packages. All packages come as source code and objects are marked internal so they aren't exposed from your build.

License

spritely/Recipes.Mvc

Repository files navigation

Build status

Spritely.Recipes.Mvc

Collection of simple pieces of reusable code (for ASP.NET MVC) designed such that dependencies aren't forced upon consumers of its packages. All packages come as source code and objects are marked internal so they aren't exposed from your build.

Spritely.Recipes.Mvc.CatchAllRoute

Provides code to add a catch all route to MVC for single page applications (SPAs) so the client app can use non-hash urls via JavaScript pushState. After adding this recipe make the following changes to your MVC application:

  1. Add the catch-all route to your route table:
  // Where Home/Index are the HomeController and Index action which serves your JavaScript application
  RouteTable.Routes.Add("CatchAll", new CatchAllRoute("Home", "Index"));
  1. Add the following 404 handler to your web.config so that anything handled by IIS has the same behavior:
  <httpErrors errorMode="Custom" existingResponse="Replace">
      <remove statusCode="404" />
      <error statusCode="404" responseMode="ExecuteURL" path="/Home/Index" />
  </httpErrors>

About

Collection of simple pieces of reusable code (for ASP.NET MVC) designed such that dependencies aren't forced upon consumers of its packages. All packages come as source code and objects are marked internal so they aren't exposed from your build.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published