[英]return View() returns an error when passing a variable storing the path name
[英]Difference between passing and not passing a view name in the View() method when we return from an Actionresult
在Action
中将视图名传递和不传递给View()
方法有什么区别?
public ActionResult Index()
{
return View();
}
VS
public ActionResult Index()
{
return View("Index");
}
在不接收任何参数的情况下, view()
返回什么?
如果不传递视图名称,则将传递操作名称。 就您而言,当您编写return View();
就像写return View("Index");
如果您的操作名称更改,这将很有帮助。 仅当您在多个操作中使用共享视图时,才传递视图名称。 对于其他情况,请将其留空。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.