【问题标题】:An unhandled exception occurred while processing the request in mvc在 mvc 中处理请求时发生未处理的异常
【发布时间】:2018-11-22 11:03:06
【问题描述】:

当我从控制器重定向视图页面时显示的主题错误。

这是完整的错误

处理请求时发生未处理的异常。 InvalidOperationException:未找到视图“~/Views/Udhyog/Services.cshtml”。搜索了以下位置: ~/Views/Udhyog/Services.cshtml

这是我的控制器代码

public virtual IActionResult Index()
{
    return View("~/Views/Udhyog/Services.cshtml");
}

我很惊讶为什么会出现这种类型的错误,因为在视图中 => Udhyog 命名了一个文件夹,并且我想显示 services.cshtml 视图页面。

那么,是我的代码错误还是有其他方法可以重定向视图页面?

【问题讨论】:

    标签: asp.net-mvc view controller


    【解决方案1】:

    return View("../UdhyogMaster/Services");

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-20
      • 2021-02-20
      • 2020-11-14
      • 2020-06-09
      • 1970-01-01
      • 2019-10-22
      相关资源
      最近更新 更多