title: HTTP 404 error when debugging in Asp.net MVC5
body: <p>I am new to MVC. I am trying to create a simple user registration process </p>
  
  <p>When I try to run the application I have the error  HTTP 404.
  The resource cannot be found.
  Requested URL: /Mvc_Web_Project/Views/CreateNewUser/AddUser.cshtml</p>
  
  <p>Solution i found online did not solve the issue</p>
  
  <p>RouteConfig.cs</p>
  
  <pre><code>public static void RegisterRoutes(RouteCollection routes)
      {
  
        routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "CreateNewUser", action = "AddUser", id = UrlParameter.Optional }
          );
      }
  </code></pre>
  
  <p>Controller.cs</p>
  
  <pre><code>using System.Web.Mvc;
  using System.Data.SqlClient;
  using System.Configuration;
  using System.Data;
  using Mvc_Web_Project.Models;
  
   namespace Mvc_Web_Project.Controllers
   {
     public class CreateNewUserController : Controller
     {
      private SqlConnection con;
      private void connection()
      {
          string constr = ConfigurationManager.ConnectionStrings["Molecular"].ToString();
          con = new SqlConnection(constr);
      }
  
      // GET: CreateNewUser
      public ActionResult AddUser(AddUserModel CreateNewUser)
      {
          //To Prevent firing validation error on first page Load  
  
          if (ModelState.IsValid)
          {
              connection();
              SqlCommand com = new SqlCommand("AddUser", con);
              com.CommandType = CommandType.StoredProcedure;
              com.Parameters.AddWithValue("@Email", CreateNewUser.Email);
              com.Parameters.AddWithValue("@Password", CreateNewUser.Password);
              com.Parameters.AddWithValue("@Type", CreateNewUser.Type);               
              con.Open();
              int i = com.ExecuteNonQuery();
              con.Close();
              if (i &gt;= 1)
              {
                  ViewBag.Message = "New User Added Successfully";
              }
          }
          ModelState.Clear();
          return View();
      }
     }
    }
  </code></pre>
  
  <p>cshtml</p>
  
  <pre><code>   @model Mvc_Web_Project.Models.AddUserModel
  @{
  ViewBag.Title = "Create New User";
  Layout = "~/Views/Shared/_Layout.cshtml";
    }
  
  &lt;h2&gt;AddUser&lt;/h2&gt;
  
    @using (Html.BeginForm())
    {
      @Html.ValidationSummary(true)
  
  &lt;fieldset&gt;
      &lt;legend&gt; AddUserModel&lt;/legend&gt;
  
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Email)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Email)
          @Html.ValidationMessageFor(model =&gt; model.Email)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Password)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Password)
          @Html.ValidationMessageFor(model =&gt; model.Password)
      &lt;/div&gt;
  
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Type)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Type)
          @Html.ValidationMessageFor(model =&gt; model.Type)
      &lt;/div&gt;
  
      &lt;p&gt;
          &lt;input type="submit" value="Save details" /&gt;
      &lt;/p&gt;
  
  &lt;/fieldset&gt;
   }
  </code></pre>