Routing issue

Topics: Customizing Orchard
Feb 2, 2012 at 3:54 AM

 

Hi,

THis is my url

http://localhost:30320/OrchardLocal/Propertysearch/List?Typeid=18&Provinceid=18&Mandate=18

Here is my routing code

 

 new RouteDescriptor {
                                                   Route = new Route(
                                                         "Propertysearch/List/{Typeid}/{Provinceid}/{Mandate}",
                                                         new RouteValueDictionary {
                                                                                      {"area", "eProp.Properties"},
                                                                                      {"controller", "Propertysearch"},
                                                                                      {"action", "List"}
                                                                                     
                                                                                  },
                                                         new RouteValueDictionary (),
                                                         new RouteValueDictionary {
                                                                                      {"area", "eProp.Properties"}
                                                                                  },
                                                         new MvcRouteHandler())
                                                 },

My other routing working, But this one not working, I have  controller action with this parameter

lakmal

 

 

Coordinator
Feb 2, 2012 at 3:57 AM

You need to provide more context: how is it not working? what are you trying to do? What are you expecting? How are you trying to achieve that?

Feb 2, 2012 at 4:04 AM

I want run this action

 public ActionResult List(int Typeid, int Provinceid, int Mandate)
        {
          //  PropertySearch pSearch = new PropertySearch();           
            var Propertiess = _PropertiesService.Search1(Typeid,Provinceid,Mandate).Cast<ContentItem>().Select(b => Services.ContentManager.BuildDisplay(b, "Summary"));
           
            var list = Shape.List();
            list.AddRange(Propertiess);

            dynamic viewModel = Shape.ViewModel()
                .ContentItems(list);

            // Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
            return View((object)viewModel);
        }

Now it returing this error

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /OrchardLocal/Propertysearch/List

 


Coordinator
Feb 2, 2012 at 4:05 AM

Well, of course, you failed to provide any of the three required parameters, and your route doesn't specify defaults.

Feb 2, 2012 at 8:36 AM

Your route is this: 

"Propertysearch/List/{Typeid}/{Provinceid}/{Mandate}"

And you're trying to access it on this url:

Propertysearch/List?Typeid=18&Provinceid=18&Mandate=18

Can you see why it's not working? Hint: They're different.