Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

Why Does This Page Not Show Up?

I'm brand new to C#, so there's the reason for my obvious lack of "sense" when it comes to this.

I'm working on an already existing project. I've been asked to construct a new page and I'm familiar enough with the MVC architecture to have an idea of what needs to be in place, but I'm stuck.

Here's a screenshot of the project as it exists currently:

User generated image
This new page is in the Maintenance Area. I've got my Controller set up (DrawingType) and the code looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace Planroom.Web.Areas.Maintenance.Controllers
{
    public class DrawingTypeController : Controller
    {
        // GET: /<controller>/
        public IActionResult Index()
        {
            return View();
        }
    }
}

Open in new window


You can tell my the graphic that it's going to the Views/DrawingType folder and looking for the Index.cshtml page, which looks like this:

@{
    ViewBag.Title = "About";
    ViewBag.BodyClass = "";
}

<div>
    <h2>Bruce's First .NET Page!</h2>
    <div>
    </div>

    <div>
        If you have any questions related to this website, please email us
        <a href="mailto:itsupport@capnet.ucla.edu">IT Staff</a>.
        <br />
    </div>
</div>

Open in new window


I'm missing something because the page keeps coming up as "not found." What am I missing?
drawingtype_controller.JPG
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi brucegust;

Look to make sure that the Routing set up for the application will handle your page. You can have a look at this web page Routing to see how routing works.
Avatar of Bruce Gust

ASKER

Fernando!

Where would I find "routing?" I've got a screenshot of the hierarchy. Where should I be looking?

User generated image
Also, what's all this "stuff" under my index.cshtml page? I don't see that with the other View pages.

User generated image
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey, Fernando!

I was able to figure it out.

I had to reference the Area at the very top of my View page...

namespace Planroom.Web.Areas.Maintenance.Controllers
{
    [Area("Maintenance")]

Thanks!