简体   繁体   中英

Web Application ASP.NET Framework do not show my page

I'm studying .NET and created an ASP.NET web application using Rider on Mac, I'm using .NET Framework v4.8.

I created a new controller called Page

using System.Web.Mvc;

namespace WebApplication1.Controllers
{
    public class Page : Controller
    {
        // GET
        public ActionResult Index()
        {
            return View("Page");
        }
    }
}

And view called Page

@model dynamic

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>Page</title>
</head>
<body>
<div>
    <h1>Page!</h1>  
</div>
</body>
</html>

When I run my project and navigate to my page

http://127.0.0.1:5000/Page/Index

I get a blank screen.

I would to know what wrong with my code (maybe this is a problem with the IDE settings) and how I can fix it to get my page.

Test the following changes

Add the word controller

    using System.Web.Mvc;
namespace WebApplication1.Controllers
{
    public class PageController : Controller
    {
        // GET
        public ActionResult Index()
        {
            return View("Page");
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM