Chicharito
Chicharito

Reputation: 1440

Asp.net Mvc Routing problem


alt text http://img243.imageshack.us/img243/3249/50263677.jpg

Global.asax Code:

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "article", action = "article", id = UrlParameter.Optional } // Parameter defaults
);

I want to use url routing like this:

www.domainname.com/Article/123/bla_article

how can ı do this ?

This work: www.domainname.com/article/article/123

this not work: www.domainname.com/article/123

please Help

Upvotes: 1

Views: 127

Answers (2)

Mark
Mark

Reputation: 6081

Like this:

routes.MapRoute( 
    "Article", 
    "Article/{id}", 
    new { controller = "article", action = "article", id = UrlParameter.Optional } 
);

Upvotes: 2

Leandro Lancelotti
Leandro Lancelotti

Reputation: 1

routes.MapRoute(
"Default", // Route name
"article/{action}/{id}", // URL with parameters
new { action = "article", id = UrlParameter.Optional } // Parameter defaults
);

Upvotes: -1

Related Questions