Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从操作链接到控制器的值始终为空_C#_Model View Controller - Fatal编程技术网

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的参数。请您提供路由配置,然后我们将决定问题所在。