I'm try to use ASP.NET 4.0 WebForms Routing. Here is my RegisterRoutes function:
void RegisterRoutes(RouteCollection routes)
{
routes.Ignore("{resource}.axd/{*pathInfo}");
routes.MapPageRoute("GoodInfo", "catalog/good/{good}", "~/GoodInfo.aspx");
routes.MapPageRoute("GoodGroup", "catalog/group/{group}", "~/default.aspx");
}
For pages like /catalog/group/{group} everything is ok. But there are problems with pages catalog/good/{good}.
First strange thing: when I open this page it calls twice. So I see what value comes for Page.RouteData.Values["good"]. First time in Page.RouteData.Values["good"] has the right value (my goodId) but the second time I got the string value "WebResource.axd"!
So my highslide JavaScript does not work on the page. And when I click on highslide image the page reloads instead of executing the JavaScript.
I added this line routes.Ignore("{resource}.axd/{*pathInfo}"); but it didn't helped me. Any ideas?
<script type="text/javascript" src="../scripts/something.js"></script>I've written something like this<script type="text/javascript" src="/../scripts/something.js"></script>. Note the extra slash on the script source. VS will complain about this, but I will work fine in runtime. I took me a while to figure this out and I had to try different combinations of paths until I finally got this path like this. Hope it works for you.