0
我需要将“字符串”值从视图传递到控制器使用HttpGet !!如何通过GET将“字符串”值从视图传递到控制器
我这样做,但它传递空:
View.cshtml
@Html.ActionLink("Profile", "Index", "UserInfo", new { name = User.Identity.Name }, new { hidefocus = "hidefocus" })
UserInfoController.cs
[HttpGet]
public ActionResult Index(string user)
{
...
}
- User.Identity.Name 是我的字符串。
谢谢。什么参数被禁止? –
null的值是“object htmlAttributes”,它不是参数。请参阅:http://screencast.com/t/93xgOe894b5 –
也可以在地址栏中删除?名称? 我希望它像 'mysite.com/UserInfo/testuser'而不是'mysite.com/UserInfo?name = testuser /' –