user2309750 user2309750 - 2 months ago 12
ASP.NET (C#) Question

Learning ASP.Net MVC and building a user manager Server Error in '/' Application

For one of my classes I'm just getting started in learning how to develop web applications in ASP.Net MVC5. One of the things we're required to do is redesign the view of a simple user account manager, with the code already given to us to work with and modify.

The problem is, when I actually run the code in Visual Studio, I get 404 error that says

Server Error in '/' Application

I'm fairly certain the code worked when it was presented in the classroom, but I can't get it to work here.

Here's the sample code, for those interested:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CS610W6.Controllers
public class UserManagerController : Controller
// GET: /UserManager/
public ActionResult Index()
//Use the application's DB context to access the Identity framework's users
var UserList = new CS610W6.Models.ApplicationDbContext().Users.ToList();

//Pass the UserList to the view
return View(UserList);


@model List<CS610W6.Models.ApplicationUser>
ViewBag.Title = "Index";

@foreach (var item in Model)
@item.UserName<br />
@item.PasswordHash<br />
@item.Id<br />
@Html.ActionLink("Edit", "Edit", new { id = item.Id })

EDIT: Here is the full text of the error, as shown in the browser,

Server Error in '/' Application.

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make
sure that it is spelled correctly.

Requested URL: /Views/index.cshtml

Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.34274

Div Div

As you're new to MVC, I assume you get this error when you try to run your application at very first time.

As we can see in your error, requested URL is /Views/index.cshtml.

This error simply means, application cannot found any route. You can either check with URL yourdomain/UserManager/Index

Or you can set default action to make change in RouteConfig

                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "UserManager", action = "Index", id = UrlParameter.Optional }

Here is also a good document for ASP.NET Routing

Hope this helps!