本文整理汇总了C#中System.Web.Mvc.AreaRegistrationContext.MapRoute方法的典型用法代码示例。如果您正苦于以下问题:C# AreaRegistrationContext.MapRoute方法的具体用法?C# AreaRegistrationContext.MapRoute怎么用?C# AreaRegistrationContext.MapRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.AreaRegistrationContext
的用法示例。
在下文中一共展示了AreaRegistrationContext.MapRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Directory",
"Cheetah/{controller}/{action}/{*location}",
new { Controller = "Document", action = "Index", Location = UrlParameter.Optional },
new[] { "Vnsf.WebHost.Areas.Cheetah.Controllers" }
);
context.MapRoute(
"Application",
"Cheetah/{controller}/{applicationId}/{action}",
new { Controller = "Application" },
new[] { "Vnsf.WebHost.Areas.Cheetah.Controllers" }
);
context.MapRoute(
"profile",
"Cheetah/UserProfile/Education/{action}",
new { controller = "UserProfile", action = "NewEducation", id = UrlParameter.Optional },
new[] { "Vnsf.WebHost.Areas.Cheetah.Controllers" }
);
context.MapRoute(
"Cheetah_default",
"Cheetah/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "Vnsf.WebHost.Areas.Cheetah.Controllers" }
);
}
示例2: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
//index
context.MapRoute(
"AdminArea_Index",
"adminarea/index.html",
new
{
action = "index",
controller = "home"
},
new[] { "Icode.Blog.Web.Areas.AdminArea.Controllers" }
);
//默认路由
context.MapRoute(
"AdminArea_default",
"adminarea/{controller}_{action}.html",
new
{
action = "index",
controller = "home"
},
new[] { "Icode.Blog.Web.Areas.AdminArea.Controllers" }
);
}
示例3: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
#region == Blog ==
context.MapRoute(
"Accounts_Blog_default",
"Accounts/Blog/{action}",
new { action = "Index", controller = "Blog" }
);
#endregion
#region == Company ==
context.MapRoute(
"Accounts_Company_default",
"Accounts/Company/{action}",
new { action = "NewsList", controller = "Company" }
);
#endregion
context.MapRoute(
"Accounts_default",
"Accounts/{action}",
new { action = "Index",controller="Accounts" }
);
}
示例4: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
var routeContraint = new UserRouteConstraint(DependencyResolver.Current.GetService<IUserRepository>());
context.MapRoute(
"Users_albums",
"{username}/albums/{id}/{name}",
new { controller = "albums", action = "name", id="id"},
constraints: new
{
username = routeContraint,
});
context.MapRoute(
"Users_date",
"{username}/{year}/{month}/{day}",
new { controller = "date", action = "Index", month = UrlParameter.Optional, day = UrlParameter.Optional },
constraints: new
{
username = routeContraint,
year = @"\d{4}"
});
context.MapRoute(
"Users_media",
"{username}/media/{id}",
new { controller = "Media", action = "Index" },
constraints: new { username = routeContraint });
context.MapRoute(
"Users_default",
"{username}/{controller}/{action}/{id}",
new { controller = "index", action = "Index", id = UrlParameter.Optional },
constraints: new { username = routeContraint });
}
示例5: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
name: "Forums_default",
url: "Forums",
defaults: new
{
controller = "Home",
action = "Index"
},
namespaces: new[] { "Zanshin.Areas.Forums.Controllers" });
context.MapRoute(name: "Topic_Default",
url: "Forums/{forumId}",
defaults: new
{
controller = "Home",
action = "Topics",
forumId = UrlParameter.Optional
}, namespaces: new[] { "Zanshin.Areas.Forums.Controllers" });
context.MapRoute(name: "Posts_default",
url: "Forums/Posts/{topicId}",
defaults: new
{
controller = "Home",
action = "Posts",
topicId = UrlParameter.Optional
}, namespaces: new[] { "Zanshin.Areas.Forums.Controllers" });
}
示例6: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"ServerSentEvent_StatusChangeServerUpdate",
"StatusChangeServerUpdate",
new { controller = "User", action = "StatusChangeEvent", id = UrlParameter.Optional }
);
context.MapRoute(
"ServerSent_AdminUserStatusChange",
"UserStatusChange",
new { controller = "Admin", action = "UserStatusChange", id = UrlParameter.Optional }
);
context.MapRoute(
"ServerSent_AdminActionOnAll",
"ActionOnAll",
new { controller = "Admin", action = "ActionOnAll", id = UrlParameter.Optional }
);
context.MapRoute(
"Html5_default",
"Html5/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
示例7: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"ForumHome",
"Forum/Home",
new { controller = "Home", action = "Index" },
new[] { "EstateSocialSystem.Web.Controllers" });
context.MapRoute(
"ForumLogOff",
"Forum/Account/LogOff",
new { controller = "Account", action = "LogOff" },
new[] { "EstateSocialSystem.Web.Controllers" });
context.MapRoute(
"Get questions by tag",
"questions/tagged/{tag}",
new { controller = "Questions", action = "GetByTag" },
new[] { "EstateSocialSystem.Web.Areas.Forum.Controllers" });
context.MapRoute(
"Display question",
"questions/{id}",
new { controller = "Questions", action = "Display" },
new[] { "EstateSocialSystem.Web.Areas.Forum.Controllers" });
context.MapRoute(
"Forum_default",
"Forum/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
new[] { "EstateSocialSystem.Web.Areas.Forum.Controllers" }
);
}
示例8: RegisterArea
/// <summary>
/// Create the routes for the area
/// </summary>
/// <param name="context"></param>
/// <remarks>
/// By using the context to register the routes it means that the area is already applied to them all
/// and that the namespaces searched for the controllers are ONLY the ones specified.
/// </remarks>
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Umbraco_back_office",
GlobalSettings.UmbracoMvcArea + "/{action}/{id}",
new {controller = "BackOffice", action = "Default", id = UrlParameter.Optional},
//limit the action/id to only allow characters - this is so this route doesn't hog all other
// routes like: /umbraco/channels/word.aspx, etc...
new
{
action = @"[a-zA-Z]*",
id = @"[a-zA-Z]*"
},
new[] {typeof (BackOfficeController).Namespace});
//Create the install routes
context.MapRoute(
"Umbraco_install_packages",
"Install/PackageInstaller/{action}/{id}",
new {controller = "InstallPackage", action = "Index", id = UrlParameter.Optional},
new[] {typeof (InstallPackageController).Namespace});
//Create the REST/web/script service routes
context.MapRoute(
"Umbraco_web_services",
GlobalSettings.UmbracoMvcArea + "/RestServices/{controller}/{action}/{id}",
new {controller = "SaveFileController", action = "Index", id = UrlParameter.Optional},
//look in this namespace for controllers
new[] {"Umbraco.Web.WebServices"});
}
示例9: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
RegisterAreaEmbeddedResources();
RegisterEmbeddedViewEngine();
context.MapRoute(
"ControlPanel_resources",
"ControlPanel/{resourceType}/{resourceName}",
new {controller = "EmbeddedResource", action = "Index"},
new {resourceType = "^(Fonts|Scripts|Styles|Images)$"},
new[] { "AzureWebFarm.ControlPanel.Areas.ControlPanel.Controllers" }
);
context.MapRoute(
"ControlPanel_home",
"",
new {action = "Index", controller = "Home"},
new[] { "AzureWebFarm.ControlPanel.Areas.ControlPanel.Controllers" }
);
context.MapRoute(
"ControlPanel_default",
"ControlPanel/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
new[] { "AzureWebFarm.ControlPanel.Areas.ControlPanel.Controllers" }
);
}
示例10: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute("InvoiceEmail", "email/invoice/{orderGuid}/{orderId}", new { controller = "InvoiceEmail", action = "Index" });
context.MapRoute("ContactUsEmail", "email/contact-us", new { controller = "ContactUsEmail", action = "Index" });
context.MapRoute("Emails_default", "Emails/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional });
}
示例11: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Admin",
"admin",
new { controller = "Admin", action = "Default", lang = "ru" },
new { lang = @"ru|en" },
new[] { "Leo.Areas.Admin.Controllers" }
);
context.MapRoute(
"Admin_Category",
"{lang}/admin/{controller}/{action}/{id}",
new { controller = "Admin", action = "Default", id = UrlParameter.Optional },
new { lang = @"ru|en" },
new[] { "Leo.Areas.Admin.Controllers" }
);
//context.MapRoute(
// "Admin_default",
// "admin/{controller}/{action}/{id}",
// new { controller = "Admin", action = "Default", id = UrlParameter.Optional},
// new[] { "Leo.Areas.Admin.Controllers" }
//);
}
示例12: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Blog_default",
"{culture}/blog/",
new { culture = string.Empty, area = "blog", controller = "Blog", action = "Index", id = UrlParameter.Optional },
new { controller = "blog" },
new string[] { "Horizon.Web.Areas.Blog.Controllers" });
context.MapRoute(
"blog-categories",
"{culture}/blog/categories)",
new { culture = string.Empty, area = "blog", controller = "blog", action = "Categories" },
new { controller = "blog" },
new string[] { "Horizon.Web.Areas.Blog.Controllers" });
context.MapRoute(
"blog-category-view",
"{culture}/blog/category/{categoryname}",
new { culture = string.Empty, area = "blog", Controller = "Blog", action = "Category", categoryname = UrlParameter.Optional },
new { controller = "blog" },
new string[] { "Horizon.Web.Areas.Blog.Controllers" });
context.MapRoute(
"blog-post-view",
"{culture}/blog/{year}/{month}/{day}/{postname}",
new { culture = string.Empty, area = "blog", controller = "blog", action = "Post", year = UrlParameter.Optional, month = UrlParameter.Optional, day = UrlParameter.Optional },
new { controller = "blog" },
new string[] { "Horizon.Web.Areas.Blog.Controllers" });
}
示例13: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"ReceivedBids",
"Project/{id}/Bid/Received",
new { controller = "Bid", action = "Received", id = UrlParameter.Optional },
new { controller = @"Bid", action = "Received" },
new[] { @"BCWeb.Areas.Project.Controllers" }
);
context.MapRoute(
"InvitationRequests",
"Project/{id}/Invitation/Requests",
new { controller = "Invitation", action = "Requests", id = UrlParameter.Optional },
new { controller = @"Invitation", action = "Requests" },
new[] { @"BCWeb.Areas.Project.Controllers" }
);
context.MapRoute(
"BidPackageInvite",
"Project/BidPackage/{bidPackageId}/Invitation/Send",
new { controller = "Invitation", action = "SendForBidPackage", bidPackageId = UrlParameter.Optional },
new { controller = @"Invitation", action = "SendForBidPackage" },
new[] { @"BCWeb.Areas.Project.Controllers" }
);
context.MapRoute(
"Project_default",
"Project/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
new { controller = @"BidPackage|Invitation|Bid|Document" },
new[] { @"BCWeb.Areas.Project.Controllers" }
);
}
示例14: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"ListShopsAll",
"Api/Shops",
new
{
controller = "Shops",
action = "ShopsList",
page = UrlParameter.Optional,
count = UrlParameter.Optional
}
);
context.MapRoute(
"ListShopPaged",
"Api/Shops/ShopsList/{pageNum}/{chunkSize}",
new
{
controller = "Shops",
action = "ShopsList",
pageNum = UrlParameter.Optional,
chunkSize = UrlParameter.Optional
}
);
context.MapRoute(
"Api_default",
"Api/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
示例15: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Search_default",
"Search",
new { controller = "Search", action = "ProcessSearchFormInput", id = UrlParameter.Optional, area = "Search" },
new[] { "Destination2.WebUi.Search.Controllers" }
);
context.MapRoute(
"PackageSerarchWaitFlight",
"Search/Package-Flight-Wait",
new { controller = "Wait", action = "FlightWait", id = UrlParameter.Optional, area = "Search" },
new[] { "Destination2.WebUi.Search.Controllers" }
);
context.MapRoute(
"PackageSerarchWaitFlightSearchStart",
"Search/Package-Flight-Start",
new { controller = "Wait", action = "FlightSearchStart", id = UrlParameter.Optional, area = "Search" },
new[] { "Destination2.WebUi.Search.Controllers" }
);
context.MapRoute(
"PackageSearchWaitFlightSearchStart",
"Search/Package-Flight-Results",
new { controller = "Results", action = "FlightResults", id = UrlParameter.Optional, area = "Search" },
new[] { "Destination2.WebUi.Search.Controllers" }
);
}