views:

618

answers:

1

I'm trying to use Url Routing within my existing ASP.NET WebForms site. Thanks to: this link, I got it working. Now I'm trying to use a SiteMap along with my routing.

I have a page MyReport.aspx. It is in the SiteMap and accessing the page directly, works fine. I've added a route for /report/{param1}/{param2}. I was hoping the sitemap would resolve the route path (MyReport.aspx) instead of /report/{param1}/{param2}, but no dice.

I have seen examples of using the SiteMap with MVC, but this makes assumptions about having controllers and such, none of which exist with a standard webform.

The approach I'm trying now is to retrieve the actual page within a custom SiteMapProvider, but I'm not seeing a way to do this. Is there a way to get the actual ASPX page instead of the Url from the HttpContext?

Thanks, -Damien

A: 

Damien - I recently posted a sample that might be useful. Googling "asp.net routing sitemap" should get you there (only just joined SO so can't post link yet).

Fyi you can use the SiteMap.SiteMapResolve event instead of creating a custom SiteMapProvider (for simple scenarios at least).

Hope it helps!

http://chriscavanagh.wordpress.com/2009/05/19/asp-net-webform-routing-with-sitemaps/