Adding route doesn't work...

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 anni tempo fa
Hi,

I am trying to add two routes in the RouteProvider:


routes.MapLocalizedRoute("AddQuantity",
                            "shoppingcart/addquantitytoproduct/{productId}",
                            new { controller = "ShoppingCart", action = "AddQuantityToProduct", productId =
                            UrlParameter.Optional },
                            new[] { "Nop.Web.Controllers" });
routes.MapLocalizedRoute("RemoveQuantity",
                            "shoppingcart/removequantityfromproduct/{productId}",
                            new { controller = "ShoppingCart", action = "RemoveQuantityFromProduct", productId =
                            UrlParameter.Optional },
                            new[] { "Nop.Web.Controllers" });


This is working in Visual Studio 2010 SP1, but not on the server. Why?

(Background:
I am building an Ajax-shoppingcart. In this shoppingcart I am using Ajax.ActionLink to get links where I can add or remove products directly in the cart. In VisualStudio I get a link like this:
/shoppingcart/addquantitytoproduct/16

On the server I get a link like this:
/shoppingcart/addquantitytoproduct?productId=16


/Johan Davidsson
12 anni tempo fa
Anyone who knows how to add a route in nopCommerce 2.1?
12 anni tempo fa
Is it necessary to do anything with IIS when I have changed the RouteProvider.cs? I read that since the routes are added in Application_Start in Global.asax.cs it is necessary to restart IIS. Correct?
12 anni tempo fa
No. But you should recompile the solution and upload updated assembly to your server
12 anni tempo fa
I found the answer... I worked in "release mode", but for some reason the deploy took the routing from the "debug mode"... Once I compiled both debug and release mode it worked...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.