?id={id} in URL instead of /{id}

0 views
Skip to first unread message

Sosh

unread,
Jun 1, 2009, 2:03:42 PM6/1/09
to S#arp Architecture
Hi All,

Sorry for another basic question... I just set up an intial project
and created the scaffolding for a new domain object, which seems to be
working ok. However Html.ActionLink seems to be producing ids like
this: ?id={id} instead of: /{id}

Any idea what might be causing this?

Thanks,

S

Ariel Popovsky

unread,
Jun 2, 2009, 2:15:05 PM6/2/09
to S#arp Architecture
Check the order of your routes, put those that are more specific
first, I had a similar problem because one without the id took
precedence over the other.
Posting your routes may be useful for helping you.

ercü eser

unread,
Jun 2, 2009, 3:05:49 PM6/2/09
to sharp-arc...@googlegroups.com
You can change your RouteRegistrar.cs from

 routes.CreateArea("Root", "Northwind.Web.Controllers",
                routes.MapRoute(null, "{controller}/{action}", new { controller = "Home", action = "Index" })
            );

to something like:

routes.CreateArea("Root", "Northwind.Web.Controllers",
                routes.MapRoute(null, "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id=0 }),
                routes.MapRoute(null, "{controller}/{action}", new { controller = "Home", action = "Index" })
               
            );
--
Ercu ESER
http://twitter.com/ercu
http://www.ercueser.com

Reply all
Reply to author
Forward
0 new messages