![](/img/trans.png)
[英]Get really current class name in Page_Load method - ASP.NET Web Application (.NET Framework)
[英]Web Application ASP.NET Framework do not show my page
我正在學習 .NET 並在 Mac 上使用 Rider 創建了一個 ASP.NET Web 應用程序,我使用的是 .NET Framework v4.8。
我創建了一個名為 Page 的新控制器
using System.Web.Mvc;
namespace WebApplication1.Controllers
{
public class Page : Controller
{
// GET
public ActionResult Index()
{
return View("Page");
}
}
}
並查看名為 Page
@model dynamic
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>Page</title>
</head>
<body>
<div>
<h1>Page!</h1>
</div>
</body>
</html>
當我運行我的項目並導航到我的頁面時
我得到一個空白屏幕。
我想知道我的代碼有什么問題(也許這是 IDE 設置的問題)以及如何修復它以獲得我的頁面。
測試以下更改
添加詞控制器
using System.Web.Mvc;
namespace WebApplication1.Controllers
{
public class PageController : Controller
{
// GET
public ActionResult Index()
{
return View("Page");
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.