本文整理汇总了C#中RouteCollection.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.Insert方法的具体用法?C# RouteCollection.Insert怎么用?C# RouteCollection.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteCollection
的用法示例。
在下文中一共展示了RouteCollection.Insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
ViewEngines.Engines.Add(new CustomViewEngine());
var routeArticleGroupAdmin = routes.MapRoute("Plugin.Misc.Articles.ArticleGroup.Admin",
"Admin/ArticleGroup/{action}/{id}",
new { controller = "ArticleGroup", action = "Index", id = UrlParameter.Optional },
new[] { "Toi.Plugin.Misc.Articles.Controllers" }
);
routeArticleGroupAdmin.DataTokens.Add("area", "admin");
routes.Remove(routeArticleGroupAdmin);
routes.Insert(0, routeArticleGroupAdmin);
var routeArticleAdmin = routes.MapRoute("Plugin.Misc.Articles.Article.Admin",
"Admin/Article/{action}/{id}",
new { controller = "Article", action = "Index", id = UrlParameter.Optional },
new[] { "Toi.Plugin.Misc.Articles.Controllers" }
);
routeArticleAdmin.DataTokens.Add("area", "admin");
routes.Remove(routeArticleAdmin);
routes.Insert(0, routeArticleAdmin);
//routes.MapRoute("ArticleAdmin",
// "Admin/Plugins/ArticleManagement/ArticleAdmin/{action}/{id}",
// new { controller = "ArticleAdmin", action = "Index", id = UrlParameter.Optional },
// new[] { "Nop.Plugin.Other.ArticleManagement.Controllers" }
// ).DataTokens.Add("area", "admin"); ;
}
示例2: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
var route = routes.MapRoute("Plugin.Tameion.Auctions.Public.AuctionsController",
"Auctions/{action}/{id}",
new { area = "Public", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
new[] { "Nop.Plugin.Tameion.Auctions.Areas.Public.Controllers" }
);
routes.Remove(route);
routes.Insert(0, route);
route = routes.MapRoute("Plugin.Tameion.Auctions.Vendor.AuctionsController",
"Vendor/Auctions/{action}/{id}",
new { area = "Vendor", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
new[] { "Nop.Plugin.Tameion.Auctions.Areas.Vendor.Controllers" }
);
routes.Remove(route);
routes.Insert(0, route);
route = routes.MapRoute("Plugin.Tameion.Auctions.Admin.AuctionsController",
"Admin/Auctions/{action}/{id}",
new { area = "Admin", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
new[] { "Nop.Plugin.Tameion.Auctions.Areas.Admin.Controllers" }
);
routes.Remove(route);
routes.Insert(0, route);
ViewEngines.Engines.Insert(0, new CustomViewEngine());
}
示例3: InstallRoutes
static void InstallRoutes(RouteCollection routes)
{
var assetRoute = new Route("_instantcss/assets/{*path}", new AssetRouteHandler());
routes.Insert(0, assetRoute);
var connectionRoute = routes.MapConnection<ExpressCssConnection>("ExpressCss", "_instantcss/connection/{*operation}");
routes.Remove(connectionRoute);
routes.Insert(1, connectionRoute);
}
示例4: InitializeDynamicData
private static void InitializeDynamicData(RouteCollection routes, string root, IAppConfiguration configuration)
{
try
{
DefaultModel.RegisterContext(
new EFCodeFirstDataModelProvider(
() => new EntitiesContext(configuration.SqlConnectionString, readOnly: false)), // DB Admins do not need to respect read-only mode.
configuration: new ContextConfiguration { ScaffoldAllTables = true });
}
catch (SqlException e)
{
QuietLog.LogHandledException(e);
return;
}
catch (DataException e)
{
QuietLog.LogHandledException(e);
return;
}
// This route must come first to prevent some other route from the site to take over
_route = new DynamicDataRoute(root + "/{table}/{action}")
{
Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
Model = DefaultModel
};
routes.Insert(0, _route);
routes.MapPageRoute(
"dd_default",
root,
"~/Areas/Admin/DynamicData/Default.aspx");
}
示例5: RegisterRoutes
/// <summary>
/// Registers the routes.
/// </summary>
/// <param name="routeCollection">The route collection.</param>
public static void RegisterRoutes(RouteCollection routeCollection)
{
List<RouteBase> routes = new List<RouteBase> {
new Route("sitemap.xml",
new RouteValueDictionary(
new { controller = "XmlSiteMap", action = "Index", page = 0 }),
new MvcRouteHandler()),
new Route("sitemap-{page}.xml",
new RouteValueDictionary(
new { controller = "XmlSiteMap", action = "Index", page = 0 }),
new MvcRouteHandler())
};
if (routeCollection.Count == 0)
{
foreach (var route in routes)
{
routeCollection.Add(route);
}
}
else
{
foreach (var route in routes)
{
routeCollection.Insert(routeCollection.Count - 1, route);
}
}
}
示例6: InstallRoute
static void InstallRoute(RouteCollection routes)
{
var route = new CassetteRoute(
"_cassette/jasmine/{*specbundle}",
new DelegateRouteHandler(context => new PageHandler(context))
);
routes.Insert(0, route);
}
示例7: RegisterArea
public virtual void RegisterArea(RouteCollection routes, ViewEngineCollection viewEngines, IEngine engine)
{
var route = new ContentRoute<IManagementHomePart>(engine);
routes.Insert(0, route);
var viewLocationFormats = new[] { Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/{1}/{0}.ascx"), Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/Shared/{0}.ascx") };
viewEngines.Insert(0, new PrivateViewEngineDecorator(new WebFormViewEngine { AreaViewLocationFormats = viewLocationFormats, PartialViewLocationFormats = viewLocationFormats }, route));
}
示例8: RegisterDefault
/// <summary>
/// Used in Gloabal.asax to setup this CacheManager to handle paths where the RouteOptions.BasePath
/// leading directory is used to distinguish the paths
/// </summary>
/// <param name="routes"></param>
/// <param name="opts"></param>
public static void RegisterDefault(RouteCollection routes, CachingOptions opts = null)
{
opts = opts ?? new CachingOptions();
var path = string.Format("{0}/{{hash}}/{{type}}/{{*path}}", opts.BasePath);
var mgr = new CacheManager(LoadAssets(opts.CacheFile), opts);
routes.Insert(0, new Route(path, new CacheHandler(mgr)));
Instance = mgr;
}
示例9: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
ViewEngines.Engines.Insert(0, new PluginViewEngine());
//contact us example
var route = routes.MapRoute("ContactUsCustom","contactus",
new { controller = "ContactUs", action = "ContactUs" },
namespaces: new[] { "Nop.Plugins.MyStore.Controllers" }
);
routes.Remove(route);
routes.Insert(0, route);
route = routes.MapRoute("ProductExtendedFields",
"Admin/Category/ProductExtendedFields/{productId}",
new { controller = "ExtendedFields", action = "ProductExtendedFields" },
new[] { "Nop.Plugins.MyStore.Controllers" }
);
route.DataTokens.Add("area", "admin");
routes.Remove(route);
routes.Insert(0, route);
}
示例10: AddNotFoundRoute
void AddNotFoundRoute(RouteCollection routes)
{
// To allow IIS to execute "/notfound" when requesting something which is disallowed,
// such as /bin or /add_data.
var route = new Route(
"notfound",
new RouteValueDictionary(new {controller = "NotFound", action = "NotFound"}),
new RouteValueDictionary(new {incoming = new IncomingRequestRouteConstraint()}),
new MvcRouteHandler()
);
// Insert at start of route table. This means the application can still create another route like "{name}" that won't capture "/notfound".
routes.Insert(0, route);
}
示例11: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
using (routes.GetWriteLock())
{
routes.Insert(
0,
new Route(
CacheTagMvcSettings.RouteUrl,
new RouteValueDictionary(new {controller = "CacheTag", action = "Resource"}),
new MvcRouteHandler()
)
);
routes.Insert(
0,
new Route(
CacheTagMvcSettings.RouteUrl + ".{ext}",
new RouteValueDictionary(new { controller = "CacheTag", action = "Resource", ext = UrlParameter.Optional }),
new MvcRouteHandler()
)
);
}
}
示例12: ConfigureEditRoute
public void ConfigureEditRoute(RouteCollection routes, string prefix)
{
var routeValueDictionary = new RouteValueDictionary
{
{"controller", "ReallyTinyCms"},
{"action", "Index"},
{"name", UrlParameter.Optional}
};
var route1 = new Route(prefix + "/{action}/{name}", routeValueDictionary, new MvcRouteHandler());
var route2 = new Route(prefix + "/{action}/{name}", routeValueDictionary, new MvcRouteHandler());
routes.Add("ReallyTinyCmsAdmin", route1);
routes.Insert(0, route2);
}
示例13: Register
public static void Register(RouteCollection routes)
{
// This route must come first to prevent some other route from the site to take over
routes.Insert(0, new DynamicDataRoute("dbadmin/{table}/{action}")
{
Constraints = new RouteValueDictionary(new {action = "List|Details|Edit|Insert"}),
Model = DefaultModel
});
routes.MapPageRoute(
"dd_default",
"{dbadmin}",
"~/DynamicData/Default.aspx",
true,
new RouteValueDictionary(),
new RouteValueDictionary {{"dbadmin", "dbadmin"}});
}
示例14: Register
public static void Register(RouteCollection routes)
{
DefaultModel.RegisterContext(
new EFCodeFirstDataModelProvider(() => new EntitiesContext()),
new ContextConfiguration() { ScaffoldAllTables = true });
// This route must come first to prevent some other route from the site to take over
routes.Insert(0, new DynamicDataRoute("dbadmin/{table}/{action}")
{
Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
Model = DefaultModel
});
routes.MapPageRoute(
"dd_default",
"dbadmin",
"~/DynamicData/Default.aspx");
}
示例15: Register
public static void Register(RouteCollection routes)
{
DefaultModel.RegisterContext(
() => ((IObjectContextAdapter)new ReviewRDbContext()).ObjectContext,
new ContextConfiguration() { ScaffoldAllTables = true });
DefaultModel.DynamicDataFolderVirtualPath = "~/DynamicData/DynamicData";
// This route must come first to prevent some other route from the site to take over
routes.Insert(0, new DynamicDataRoute("_dbadmin/{table}/{action}")
{
Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
Model = DefaultModel
});
routes.MapPageRoute(
"dd_default",
"_dbadmin",
"~/DynamicData/Default.aspx");
}