dae*_*aai 3 routes umbraco extend global-asax
有谁知道如何在umbraco 4.10之后扩展Global.ascx?我想在我的应用程序中注册自定义路由.
我已将代码添加到global.ascx并继承如下:
public class Global : Umbraco.Web.UmbracoApplication
{
protected override void OnApplicationStarting(object sender, EventArgs e)
{
base.OnApplicationStarting(sender, e);
}
//protected void Application_Start(object sender, EventArgs e)
//{
//}.....
Run Code Online (Sandbox Code Playgroud)
如果我理解了这个错误并且您无法扩展global.ascx文件,请更正.
编辑:我知道你可以用config做到这一点,但我认为在global.ascx做以后做复杂路由会好得多.
非常感谢.
你当然是在正确的道路上.您可以采用与通常情况类似的方式执行此操作:
protected override void OnApplicationStarted(object sender, EventArgs e)
{
base.OnApplicationStarted(sender, e);
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute("SitemapXml", "sitemap.xml", new { controller =
"SitemapSurface", action = "XmlSitemap" });
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1154 次 |
| 最近记录: |