Problems with ELMAH route in Dinamico

Topics: Developer Forum
Feb 19, 2012 at 7:11 PM

Hi,

I setup ELMAH on my N2 Dinamico site. When I try to view the second (or subsequent) pages of ELMAH results, instead of seeing more ELMAH results, I see different pages on my site.

It appears that the "page" parameter is forcing my ELMAH route to get intercepted by the default content route of N2. From my debugging, it looks like the Analytics route is getting in the way as well.

How can I force my ELMAH route to pre-empt these routes?

Here is the code from my MvcApplication:

public static void RegisterRoutes(RouteCollection routes)
{
	routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        "Admin_elmah",
        "Admin/elmah/{type}",
        new { action = "Index", controller = "Elmah", type = UrlParameter.Optional }
    );

	routes.MapRoute(
		"Default", // Route name
		"{controller}/{action}/{id}", // URL with parameters
		new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
	);
}

Feb 20, 2012 at 3:15 PM

Hi.

I had exact same problem. I discovered that "page" query string key is reserved for N2 to determine which page to load (by id).

So I've updated App_Data\n2_host.config with pageQueryKey which overrides the default "page" key.

<host rootID="1" startPageID="2" multipleSites="true">
 <web extension="" pageQueryKey="pg"/>
 <vpp>
  <zips>
   <add filePath="~/N2/N2.zip" observedPath="~/N2/" name="n2.management" />
  </zips>
 </vpp>
</host>

Hope it helps.

Feb 21, 2012 at 3:14 AM

Thank you very much!

That solved my problem.

Jul 3, 2012 at 8:37 AM

I ran into this problem also today. I've integrated Yaf (Yet Another Forum), and when getting lots of topics in a thread in that forum, it appends a page indicator called.... "page".

Wouldn't it be an idea to change the default query string param to something a bit more uncommon? for example "n2pageid" or something? Just my 2 öre.