日期:2014-05-17 浏览次数:20542 次
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//routes.MapRoute(
// "DefaultTT", // Route name
// "test", // URL with parameters
// new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
//);
RouteValueDictionary defaults = new RouteValueDictionary();
RouteValueDictionary constraints = new RouteValueDictionary();
RouteValueDictionary tokens = new RouteValueDictionary();
defaults.Add("controller", "home");
defaults.Add("action", "index");
defaults.Add("data", string.Empty);
constraints.Add("data", @"[a-zA-Z0-9\-]*");
tokens.Add("pageId", 0);
routes.Add(new Route("", defaults, constraints, tokens, new MyRouteHandler()));
}
protected void Application_Start()