开发者

ActionLink in Asp.Net Mvc 2 does not reidrect

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 a开发者_StackOverflow中文版nd 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.


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)%>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜