本文整理汇总了C#中System.Web.Mvc.AreaRegistrationContext类的典型用法代码示例。如果您正苦于以下问题:C# AreaRegistrationContext类的具体用法?C# AreaRegistrationContext怎么用?C# AreaRegistrationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AreaRegistrationContext类属于System.Web.Mvc命名空间,在下文中一共展示了AreaRegistrationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
// TRANSLATION ROUTING
CultureInfo cultureEN = CultureInfo.GetCultureInfo("en-US");
CultureInfo cultureIT = CultureInfo.GetCultureInfo("it-IT");
DictionaryRouteValueTranslationProvider translationProvider = new DictionaryRouteValueTranslationProvider(
new List<RouteValueTranslation> {
//new RouteValueTranslation(cultureIT, "Document", "preventivi-commesse-tipografia"),
//new RouteValueTranslation(cultureIT, "ListEstimate", "elenco-documenti-centro-stampa"),
//new RouteValueTranslation(cultureIT, "CreateProduct", "inserimento-di-uno-stampato"),
//new RouteValueTranslation(cultureIT, "Error", "errore"),
//new RouteValueTranslation(cultureIT, "NoTaskEstimatedOnException", "manca-definizione-costo")
}
);
context.MapTranslatedRoute(
"Working_default",
"working-area/{controller}/{action}/{id}",
new { controller = "Working", action = "Index", id = UrlParameter.Optional },
new { controller = translationProvider, action = translationProvider },
true);
//context.MapRoute(
// "Working_default",
// "Working/{controller}/{action}/{id}",
// new { action = "Index", id = UrlParameter.Optional }
//);
}
示例2: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
RouteTable.Routes.LowercaseUrls = true;
RouteTable.Routes.AppendTrailingSlash = true;
//context.MapRoute(
// "Admin_editcategoryroute",
// "Admin/{controller}/{action}/{id}",
// new { controller = "AdminCategory", action = "Index", id = UrlParameter.Optional }
//);
//context.MapRoute(
// "Admin_edituserroute",
// "Admin/{controller}/{action}/{userId}",
// new { controller = "Admin", action = "Index", userId = UrlParameter.Optional }
//);
//context.MapRoute(
// "Admin_pagingroute",
// "Admin/{controller}/{action}/{page}",
// new { controller = "Account", action = "Index", page = UrlParameter.Optional }
//);
context.MapRoute(
"Admin_defaultroute",
"Admin/{controller}/{action}/{id}",
new { controller = "Admin", action = "Index", id = UrlParameter.Optional }
);
}
示例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)
{
//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" }
);
}
示例5: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"AdminAlbumList",
"Admin/Album/List",
new { controller = "AdminAlbumController", action = "List", id = UrlParameter.Optional }
);
context.MapRoute(
"AdminAlbumCreate",
"Admin/Album/Create",
new { controller = "AlbumController", action = "Create", id = UrlParameter.Optional }
);
context.MapRoute(
"AdminAlbumEdit",
"Admin/Album/Edit/{id}",
new { controller = "AdminAlbumController", action = "Edit", id = UrlParameter.Optional }
);
context.MapRoute(
"AdminAlbumDelete",
"Admin/Album/Delete/{id}",
new { controller = "AdminAlbumController", action = "Delete" }
);
context.MapRoute(
"Admin_default",
"Admin/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
示例6: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
null,
url: "Error",
defaults: new { controller = "Error", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "LessonProject.Areas.Default.Controllers" }
);
context.MapRoute(
null,
url: "NotFoundPage",
defaults: new { controller = "Error", action = "NotFoundPage", id = UrlParameter.Optional },
namespaces: new[] { "LessonProject.Areas.Default.Controllers" }
);
context.MapRoute(
name: "lang",
url: "{lang}/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
constraints : new { lang = @"ru|en" },
namespaces: new[] { "LessonProject.Areas.Default.Controllers" }
);
context.MapRoute(
name : "default",
url : "{controller}/{action}/{id}",
defaults : new { controller = "Home", action = "Index", id = UrlParameter.Optional, lang = "ru" },
namespaces : new [] { "LessonProject.Areas.Default.Controllers" }
);
}
示例7: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
name: "Public_default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });
}
示例8: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"AdminIdeasRoute",
"Ideas/Admin/{action}/{id}",
new { controller = "AdminIdeas", action = "Index", id = UrlParameter.Optional },
new[] { "SampArch.Presentation.Area.Ideas.Controllers" }
);
context.MapRoute(
"IdeasRoute",
"Ideas/{action}/{id}",
new { controller = "SiteIdeas", action = "Index", id = UrlParameter.Optional },
new[] { "SampArch.Presentation.Area.Ideas.Controllers" }
);
context.MapRoute(
"IdeasServiceRoute",
"IdeasService/{action}/{id}",
new { controller = "IdeasService", action = "DownloadCsv", id = UrlParameter.Optional },
new[] { "SampArch.Presentation.Area.Ideas.Controllers" }
);
}
示例9: CuiAreaRegistration_RegisterArea_CuiRouteAdded_DataTokensSet
public void CuiAreaRegistration_RegisterArea_CuiRouteAdded_DataTokensSet()
{
// arrange
const string areaName = "CUI";
const string routeName = "CUI_default";
RouteCollection routes = new RouteCollection();
AreaRegistrationContext context = new AreaRegistrationContext(areaName, routes);
var registration = new CuiAreaRegistration();
// act
registration.RegisterArea(context);
// assert
var route = context.Routes[routeName] as Route;
Assert.IsNotNull(route);
Assert.AreEqual("CUI/{controller}/{action}/{id}", route.Url);
Assert.AreEqual("Main", route.Defaults["controller"]);
Assert.AreEqual("Index", route.Defaults["action"]);
Assert.AreEqual(areaName, route.Defaults["area"]);
Assert.AreEqual(UrlParameter.Optional, route.Defaults["id"]);
Assert.AreEqual("Login", route.DataTokens["LoginController"]);
Assert.AreEqual("Index", route.DataTokens["LoginAction"]);
Assert.AreEqual(areaName, registration.AreaName);
Assert.AreEqual(areaName, context.AreaName);
}
示例10: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
name: AreaName + "-Default",
url: "admin/raven/{action}/{id}",
defaults: new { controller = "RavenAdmin", action = "Index", id = UrlParameter.Optional });
}
示例11: 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" }
);
}
示例12: RegisterArea
protected override void RegisterArea(
AreaRegistrationContext context,
IApplicationBus bus,
PlatformAreaRegistrationState state)
{
this.RegisterApplicationRoutes(context);
}
示例13: RegisterApplicationRoutes
protected void RegisterApplicationRoutes(AreaRegistrationContext context)
{
context.MapRoute(
"AdminHome-Default",
"",
new { controller = "Admin", action = "Index" });
}
示例14: RegisterArea
public override void RegisterArea(AreaRegistrationContext context)
{
Config config = Config.Load();
context.MapSubdomainRoute(
"Error.Http404", // Route name
new List<string>() { "*", "error" }, // Subdomains
new List<string>() { config.Host }, // domains
"404", // URL with parameters
new { controller = "Error", action = "Http404" }, // Parameter defaults
new[] { typeof(Controllers.ErrorController).Namespace }
);
context.MapSubdomainRoute(
"Error.Http403", // Route name
new List<string>() { "*", "error" }, // Subdomains
new List<string>() { config.Host }, // domains
"403", // URL with parameters
new { controller = "Error", action = "Http403" }, // Parameter defaults
new[] { typeof(Controllers.ErrorController).Namespace }
);
context.MapSubdomainRoute(
"Error.Http500", // Route name
new List<string>() { "*", "error" }, // Subdomains
new List<string>() { config.Host }, // domains
"500", // URL with parameters
new { controller = "Error", action = "Http500" }, // Parameter defaults
new[] { typeof(Controllers.ErrorController).Namespace }
);
}
示例15: 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" });
}