Impossible to change Orchard Route

Topics: Writing modules
Apr 10, 2013 at 3:01 PM
Hi,

I just start to Orchard developpement (1.5) i did the HelloWorld module tutorial and i got a Route Problem HelloWorld Tutorial. If i copy/paste the tutorial or recover their files, it works fine for one time but if i want to change to another Route, it not work anymore.

I change to:
public IEnumerable<RouteDescriptor> GetRoutes() {
            return new[] {
                new RouteDescriptor {
                    Priority = 5,
                    Route = new Route(
                        "Hello",
                        new RouteValueDictionary {
                            {"area", "Hello"},
                            {"controller", "Home"},
                            {"action", "Index"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "Hello"}
                        },
                        new MvcRouteHandler())
                }
            };
        }
I want to tape Hello instead of HelloWorld, looks easy :/

Same problem with: http://stackoverflow.com/questions/12588280/orchard-cms-routing-not-working-on-localhost

Is it posible to change the Route in Orchard or it initialised for one time and can't be modifed anymore?

It's also the same problem when working with the types. I create a new type with new items. When you prefix a new route then impossible to change it's route value.


Thank you to share your answers
Developer
Apr 10, 2013 at 4:06 PM
You want what to be "Hello"? The Area?
Apr 10, 2013 at 11:48 PM
Edited Apr 10, 2013 at 11:51 PM
Hi Jamboo,

The area must match the Module Name: HelloWorld as in the reference example:
http://docs.orchardproject.net/Documentation/Building-a-hello-world-module

The first Hello in your code is the relative url expected. So when you hit
http://localhost:30320/OrchardLocal/Hello ...
in your browser, Orchard will look for the function: Index in the controller: Home in your area(or module): Hello.

So, is your module named Hello?
Apr 12, 2013 at 9:10 PM
Hi,

Thank you for your answer, i finally found it. I just started with orchard development so a basic fault of beginner ^^

How it work is:
                        "Hello",    => name of the url
                        new RouteValueDictionary {
                            {"area", "Hello"},  => name of the project (module)
                            {"controller", "Home"},  => name of the controller
                            {"action", "Index"}   =>  name of the action
                        },
My error was to put Hello in the area section while the name of my project was HelloWorld. So the right one should be:
                       "Hello",
                        new RouteValueDictionary {
                            {"area", "HelloWorld"},
                            {"controller", "Home"},
                            {"action", "Index"}
                        },
:)