XmlSiteMapController.RegisterRoutes(RouteTable.Routes) doesnt work on web server ?

Sep 23, 2010 at 2:56 PM

Hi,

First of all, thanks for the great provider. The issue i am trying to get it done is the code below is working as expected when working on localhost. But when i move the site to web server it doesnt work.

XmlSiteMapController.RegisterRoutes(RouteTable.Routes); 

What might be the reason ?
Thank you 

 

Coordinator
Sep 23, 2010 at 3:33 PM

Are you seeing errors?

Sep 23, 2010 at 4:38 PM

No Errors, just "The Page Cannot be Found".
But it is working on localhost 

Sep 26, 2010 at 11:26 PM
Edited Oct 4, 2010 at 11:09 AM

Were you able to find a solution ?

Thanks

Oct 2, 2010 at 8:14 AM

Could you please help ?

Thank you

Coordinator
Oct 4, 2010 at 10:22 AM

Can you share your route table?

Other solution is creating your own SiteMapController with an Index action method and returning a new XmlSiteMapResult.

Oct 4, 2010 at 11:07 AM

My route table,
routes.MapRoute(
                "Page",
                "{url}/{pageId}",
                new { controller = "Home", action = "Page" },
                new { pageId = @"\d+" }
            );

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

Could you also share a sample code about creating a new XmlSiteMapResult ?

King regards

Coordinator
Oct 6, 2010 at 12:16 PM

I think I have an idea :-) Are you registering your routes first and then adding the XmlSiteMapController.RegisterRoutes(RouteTable.Routes);, or doing XmlSiteMapController.RegisterRoutes(RouteTable.Routes); and then registering routes? The latter is the way to go...

Oct 9, 2010 at 7:20 PM

It is already like you said. What might be the reason ? It works on localhost but doesnt work on the web server

AreaRegistration.RegisterAllAreas();
            XmlSiteMapController.RegisterRoutes(RouteTable.Routes);
            RegisterRoutes(RouteTable.Routes);

Coordinator
Oct 11, 2010 at 7:35 AM

And if you swap this like

            XmlSiteMapController.RegisterRoutes(RouteTable.Routes);
AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes);
Oct 11, 2010 at 9:18 AM

I have just tried it and it doesnt work either.

Could it be about the IIS version that my server uses(iis 6.0) ?

Coordinator
Oct 11, 2010 at 10:53 AM

Nope. Best way is to just create a new action method like this:

        public ActionResult Index()
        {
            return new XmlSiteMapResult();
        }

Feel free to map a route like sitemap.xml to this action method.

Oct 11, 2010 at 11:03 AM

It was the first thing i tried, didnt work too.

Both action method and XmlSiteMapController.RegisterRoutes(RouteTable.Routes) works on localhost.
But both of them dont work on the web server. 

Coordinator
Oct 11, 2010 at 11:43 AM

Did you map the sitemap.xml file to ASP.NET engine? Check http://www.asp.net/mvc/tutorials/using-asp-net-mvc-with-different-versions-of-iis-cs, IIS6 part

Oct 13, 2010 at 11:06 AM

It's worked!
Thank you so much for your answers and for your patience.