0

I've got a controller named "TafelController.cs" and a view named "Berekenen.cshtml". (the names aren't made up by me.)

the url "http://localhost:5181/tafel/berekenen" somehow doesn't work, even when adding extensions to berekenen like ".cshtml". Decapitalizing the names of the controller and the view also doesn't work. The thing is, I get the proper view when I make the Index() method the following.

public ActionResult Index()
{
    return View("berekenen");
}

which is weird, because that's what

http://localhost:portnum/tafel/berekenen

is. when setting that page as the startpage the URL differs a bit. Then it becomes

http://localhost:5181/Views/tafel/berekenen.cshtml

Does anyone have any idea what might be happening?

3
  • 4
    Your controller needs a method public ActionResult Berekenen() { return View(); } Commented Apr 19, 2015 at 11:20
  • That solved it. Thank you. Now the problem is, how do you flag a comment as an awnser Commented Apr 19, 2015 at 11:22
  • I'll add one shortly :) Commented Apr 19, 2015 at 11:24

1 Answer 1

2

http://localhost:portnum/tafel/berekenen is trying to navigate to a method named Berekenen on TafelController. You need to add the following method

public ActionResult Berekenen()
{
    return View();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.