mercredi 6 mai 2015

404 after changing routes in ASP NET MVC application

I had working routes on my app that looked like this:

            routes.MapRoute(
            name: "Category",
            url: "{name}-c{categoryId}",
            defaults: new { controller = "Products", action = "Index", name = "ErrorName" },
            namespaces: new[] { "B2B.Controllers" });

        routes.MapRoute(
            name: "InfoPage",
            url: "{name}-i{id}",
            defaults: new { controller = "InfoPages", action = "Details", name = "ErrorName" },
            namespaces: new[] { "B2B.Controllers" });

I've changed the dash (-) to the hash (#) because spaces are changed in url to dashes.

 url: "{name}#c{categoryId}",
 url: "{name}#i{id}",

Now I've this same routes with only this one char changed and I get 404 on urls like this:

siteadess:1234/1.0.1-Podstawowa%23c4

I've also tried to change hash to under score and it didn't worked either.

Aucun commentaire:

Enregistrer un commentaire