本文整理汇总了C#中RouteCollection.MapLowercaseRoute方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapLowercaseRoute方法的具体用法?C# RouteCollection.MapLowercaseRoute怎么用?C# RouteCollection.MapLowercaseRoute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteCollection
的用法示例。
在下文中一共展示了RouteCollection.MapLowercaseRoute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Register
public static void Register(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("favicon.ico");
RegisterSpecialRoutes(routes);
// For the jQuery ajax file manager
routes.MapLowercaseRoute(
"FileFolder",
"Files/Folder/{dir}",
new { controller = "Files", action = "Folder", dir = UrlParameter.Optional }
);
// 404 error
routes.MapLowercaseRoute(
"NotFound",
"wiki/notfound",
new { controller = "Wiki", action = "NotFound", id = UrlParameter.Optional }
);
// 500 error
routes.MapLowercaseRoute(
"ServerError",
"wiki/servererror",
new { controller = "Wiki", action = "ServerError", id = UrlParameter.Optional }
);
// The default way of getting to a page: "/wiki/123/page-title"
routes.MapLowercaseRoute(
"Wiki",
"Wiki/{id}/{title}",
new { controller = "Wiki", action = "Index", title = UrlParameter.Optional }
);
// Don't lowercase pages that use Base64
routes.MapRoute(
"Pages",
"pages/byuser/{id}/{encoded}",
new { controller = "Pages", action = "ByUser", title = UrlParameter.Optional }
);
// Be explicit for the help controller, as it gets confused with the WebAPI one
routes.MapRoute(
"Roadkill.Core.Mvc.Controllers.HelpController",
"help/{action}/{id}",
new { controller = "Help", action = "Index", id = UrlParameter.Optional },
null,
new string[] { "Roadkill.Core.Mvc.Controllers" }
);
// Default
routes.MapLowercaseRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
示例2: Register
public static void Register(RouteCollection routes)
{
// Additional routing can be found in SiteSettingsAreaRegistration
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("favicon.ico");
RegisterSpecialRoutes(routes);
// For the jQuery ajax file manager
routes.MapLowercaseRoute(
"FileFolder",
"Files/Folder/{dir}",
new { controller = "Files", action = "Folder", dir = UrlParameter.Optional }
);
// 404 error
routes.MapLowercaseRoute(
"NotFound",
"wiki/notfound",
new { controller = "Wiki", action = "NotFound", id = UrlParameter.Optional }
);
// 500 error
routes.MapLowercaseRoute(
"ServerError",
"wiki/servererror",
new { controller = "Wiki", action = "ServerError", id = UrlParameter.Optional }
);
// The default way of getting to a page: "/wiki/123/page-title"
routes.MapLowercaseRoute(
"Wiki",
"Wiki/{id}/{title}",
new { controller = "Wiki", action = "Index", title = UrlParameter.Optional }
);
// Don't lowercase pages that use Base64
routes.MapRoute(
"Pages",
"pages/byuser/{id}/{encoded}",
new { controller = "Pages", action = "ByUser", title = UrlParameter.Optional }
);
// Default
routes.MapLowercaseRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
示例3: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// routes.MapLowercaseRoute("In", "in", new { controller = "Secure", action = "Dashboard" });
routes.MapLowercaseRoute("In_Routes",
"in/{controller}/{action}/{id}",
new { controller = "Secure", action = "Index", id = UrlParameter.Optional });
routes.MapLowercaseRoute(
"Default",
"{controller}/{action}/{id}",
new {controller = "Home", action = "Index", id = UrlParameter.Optional}
);
}
示例4: MapLowercaseRoute_AddsExpectedRoutes
public void MapLowercaseRoute_AddsExpectedRoutes()
{
RouteCollection routeCollection = new RouteCollection();
routeCollection.MapLowercaseRoute("TestRoute", "{controller}/{action}", new { controller = "Home", action = "Index|About|Contact" });
// assert
Assert.AreEqual(1, routeCollection.Count);
Assert.IsInstanceOf<LowercaseRoute>(routeCollection[0]);
}
示例5: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapLowercaseRoute(
"Root",
string.Empty,
defaults: new { controller = "Home", action = "Index" },
constraints: new { httpMethod = new HttpMethodConstraint("GET") });
routes.MapLowercaseRoute(
name: "About",
url: "about",
defaults: new { controller = "Home", action = "About" },
constraints: new { httpMethod = new HttpMethodConstraint("GET") });
routes.MapLowercaseRoute(
name: "validate",
url: "validate",
defaults: new { controller = "Home", action = "Validate" },
constraints: new { httpMethod = new HttpMethodConstraint("POST") });
routes.MapConnection<ExecuteEndPoint>("execute", "execute/{*operation}");
routes.MapLowercaseRoute(
name: "Update",
url: "{slug}/{version}",
defaults: new { controller = "Home", action = "Save", version = UrlParameter.Optional },
constraints: new { httpMethod = new HttpMethodConstraint("POST"), slug = @"[a-z0-9]*", });
routes.MapLowercaseRoute(
name: "Save",
url: "{slug}",
defaults: new { controller = "Home", action = "Save", slug = UrlParameter.Optional },
constraints: new { httpMethod = new HttpMethodConstraint("POST"), slug = @"[a-z0-9]*" });
routes.MapLowercaseRoute(
name: "Show",
url: "{slug}/{version}",
defaults: new { controller = "Home", action = "Show", version = UrlParameter.Optional },
constraints: new { httpMethod = new HttpMethodConstraint("GET"), slug = @"[a-z0-9]+", version = @"\d*" });
routes.MapLowercaseRoute(
name: "Latest",
url: "{slug}/latest",
defaults: new { controller = "Home", action = "Latest" },
constraints: new { httpMethod = new HttpMethodConstraint("GET"), slug = @"[a-z0-9]+" });
routes.MapRoute(
"Error",
"Error/{status}",
new { controller = "Error", action = "Index", status = UrlParameter.Optional });
// 404s
routes.MapRoute(
"404", "{*url}", new { controller = "Error", action = "Index", status = 404 });
}
示例6: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// all URLs used in the PlexCommerce are lowercase
routes.MapLowercaseRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "PlexCommerce.Web.Controllers" });
}
示例7: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// This route will only map to Controllers within the Kapital.Mvc.Controllers namespace.
// Any Areas will need their own routing maps.
routes.MapLowercaseRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
null,
new string[] { "Kapital.Mvc.Controllers" }
);
}