views:

109

answers:

1

I have the following default and only route:

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

In my Site.Master I have the following:

<%= Html.ActionLink("Profile", "Details", "Users")%>

If I am on the following Url:
http://localhost:1155/Users/Details/1 and I click the link above it goes the same page.
Should it not go to the following url?
http://localhost:1155/Users/Details

For some reason it is keeping the id in the Url.

A: 

For some reason it is keeping the id in the Url.

It is by design.

Try this to get rid of id:

<%= Html.ActionLink("Profile", "Details", "Users", new { id = "" }, null)%>
Developer Art
Thats what I wasn't sure of, whether it was by design. Would this be the best practice?
Picflight
I wouldn't call it neither worst nor best practice. It's just practice. If you wish to get rid of a persistent value, you just "erase" it in this fashion.
Developer Art