使用 kentico 门户模板的自定义路由
Custom Routes with kentico Portal Template
Asp.net 允许我们注册新的自定义路由
http://www.example.com/products.aspx?category=software
这样称呼他们:http://www.example.com/products/software
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("testroute", "Test/{parame}", "~/Default.aspx");
}
此方法适用于 Kentico,但仅适用于 .aspx 页面(例如 ~/CMSPages/Default.aspx 中的页面)。
我的问题是如何为使用门户模板方法创建的页面获得相同的结果?
我试图制作自己的 HttpHandler
public class CustomHandlerProduct : IHttpHandler
{
public CustomHandlerProduct()
{
//
// TODO: Add constructor logic here
//
}
public bool IsReusable
{
// To enable pooling, return true here.
// This keeps the handler in memory.
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
}
}
甚至根据这篇文章的 HttpModule
link to CodeProject article
但我无法达到预期的效果
有什么想法吗?
如果你想使用 Portal 引擎,有没有理由不使用 Kentico URL 重写功能?通配符 URLs 的工作方式与路由非常相似。请参阅文档 https://docs.kentico.com/display/K82/Wildcard+URLs
Asp.net 允许我们注册新的自定义路由
http://www.example.com/products.aspx?category=software
这样称呼他们:http://www.example.com/products/software
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("testroute", "Test/{parame}", "~/Default.aspx");
}
此方法适用于 Kentico,但仅适用于 .aspx 页面(例如 ~/CMSPages/Default.aspx 中的页面)。 我的问题是如何为使用门户模板方法创建的页面获得相同的结果? 我试图制作自己的 HttpHandler
public class CustomHandlerProduct : IHttpHandler
{
public CustomHandlerProduct()
{
//
// TODO: Add constructor logic here
//
}
public bool IsReusable
{
// To enable pooling, return true here.
// This keeps the handler in memory.
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
}
}
甚至根据这篇文章的 HttpModule link to CodeProject article
但我无法达到预期的效果
有什么想法吗?
如果你想使用 Portal 引擎,有没有理由不使用 Kentico URL 重写功能?通配符 URLs 的工作方式与路由非常相似。请参阅文档 https://docs.kentico.com/display/K82/Wildcard+URLs