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

Sep 23, 2010 at 3:56 PM


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.


What might be the reason ?
Thank you 


Sep 23, 2010 at 4:33 PM

Are you seeing errors?

Sep 23, 2010 at 5:38 PM

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

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

Were you able to find a solution ?


Oct 2, 2010 at 9:14 AM

Could you please help ?

Thank you

Oct 4, 2010 at 11: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 12:07 PM

My route table,
                new { controller = "Home", action = "Page" },
                new { pageId = @"\d+" }

                "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

Oct 6, 2010 at 1: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 8:20 PM

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


Oct 11, 2010 at 8:35 AM

And if you swap this like

AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes);
Oct 11, 2010 at 10: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) ?

Oct 11, 2010 at 11: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 12:03 PM

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. 

Oct 11, 2010 at 12:43 PM

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 12:06 PM

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