Link to home
Start Free TrialLog in
Avatar of danielolorenz
danielolorenz

asked on

I Added a New Page and Controller on MVC and Get an Internal Server Error?

I am building a new MVC Application.  I added a new page and a new controller.  When I go to the new page, I get the following error: The page cannot be displayed because an internal server error has occurred.

Do you know how to fix this error?

Thanks,

Dan
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

That's a bit too vague to be able to answer straight off the bat.  Firstly, can you tell if your controller is being hit or not? Put a break point on whatever action is being called by default and see if it is hit when you run your project.

A bit more detail about your controller, view and what both are doing would be helpful.
Avatar of danielolorenz
danielolorenz

ASKER

Yes, I am hitting the controller.  I set a break point in the controller and it is hitting the ActionResult Index().

I wrote a basic Controller and a Basic view with the view returning to the controller.

I Wrote a basic Controller:
using System.Web.Configuration;
using System.Web.Mvc;

namespace BCA.GunPermit.Controllers
{
    public class GunPermitSearchController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    }
}

Open in new window


View:
@{
    ViewBag.Title = "Search";
}

<h2>Search Test</h2>

<br />

<div class="gun-permit-search">
    <div id="search-purpose-code" class="well well-sm">


    </div>
</div>

Open in new window

What is your view called?  Is it called "Search", or is it called "Index"?
It is called Search
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland 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