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: /Movies/Random
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.3928.0
This is an Error Message Shown when I Started doing an online tutorial. What may be the reason for this???
Random.cshtml
@model Vidly.Models.Movie
@{
ViewBag.Title = "Random";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>@Model.Name</h2>
Movie.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Vidly.Models
{
public class Movie
{
public int Id { get; set; }
public string Name { get; set; }
}
}
MoviesController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Vidly.Models;
namespace Vidly.Controllers
{
public class MoviesController : Controller
{
// GET: Movies/Random
public ActionResult Index()
{
var movie = new Movie() { Name = "Hello" };
return View(movie);
}
}
}
Random
in yourMovies
controller and appranently it is not there. Please review how you have setup your routes inRouteConfig.cs
. - Rahul Sharma