MVC我的网址是创造"长度= 4英寸 [英] MVC my url is creating "?Length=4"

查看:101
本文介绍了MVC我的网址是创造"长度= 4英寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个应用程序MVC4。
我有一个小问题。
我的code是

I am creating an MVC4 application. I have a small issue. My code is

<li id="tabHeader_2">@Html.ActionLink("Contract", "Contract", "Home", new { id = "lnk_contract" })</li>

我收到网址结果
的http://本地主机:2355 /主页/合同长度= 4

我想我的网址为结果
的http://本地主机:2355 /主页/合约

我ruoting是

routes.MapRoute(
    name: "Default",
    url: "{controller}/{action}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

如果你有答案,请帮我...

If you have answer please help me ...

推荐答案

您混合起来的参数。你要发送匿名对象作为参数htmlAttributes

You mixed up the parameters. You have to send anonymous object as htmlAttributes parameter.

@Html.ActionLink("Contract", "Contract", "Home", null ,new { id = "lnk_contract" })

下面是这个过载的MSDN页面:

Here's the MSDN page for this overload:

<一个href=\"http://msdn.microsoft.com/en-us/library/dd504972(v=vs.108).aspx\">http://msdn.microsoft.com/en-us/library/dd504972(v=vs.108).aspx

这篇关于MVC我的网址是创造&QUOT;长度= 4英寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆