Dynamic error pages in Rails 3

In rails 3.2, it’s easier than that: Add this to config/application.rb: config.exceptions_app = self.routes That causes errors to be routed via the router. Then you just add to config/routes.rb: match “/404”, :to => “errors#not_found” I got this info from item #3 on the blog post “My five favorite hidden features in Rails 3.2” by By …

Read more

How to implement proper HTTP error handling in .NET MVC 2?

Here’s one technique you could use. Define an ErrorsController which will serve the error pages: public class ErrorsController : Controller { public ActionResult Http404() { Response.StatusCode = 404; return Content(“404”, “text/plain”); } public ActionResult Http500() { Response.StatusCode = 500; return Content(“500”, “text/plain”); } public ActionResult Http403() { Response.StatusCode = 403; return Content(“403”, “text/plain”); } } …

Read more