C# 从操作链接到控制器的值始终为空
有一个只需要一个字符串的视图C# 从操作链接到控制器的值始终为空,c#,model-view-controller,C#,Model View Controller,有一个只需要一个字符串的视图 @model string 从ActionLink呼叫 @Html.ActionLink("Clinical Desktop", "Training", "Video" , new { play = "SomeVideo.mp4" }, null) 视频控制器 public ActionResult Training(string play) { return View(play); } play始终为空 手动调用URL https://loc
@model string
从ActionLink呼叫
@Html.ActionLink("Clinical Desktop", "Training", "Video"
, new { play = "SomeVideo.mp4" }, null)
视频控制器
public ActionResult Training(string play)
{
return View(play);
}
play
始终为空
手动调用URL
https://localhost:44300/Video/Training/play?SomeVideo.mp4
试试看,您需要确保您的参数在路由中命名,例如使用{controller}/{action}/{id}路由将尝试分配一个名为“id”@Tsukasa的参数。请您提供路由配置,然后我们将决定问题所在。