Asp.net MVC5 - Object reference not set to an instance of an object.

Multi tool use
Multi tool use


Asp.net MVC5 - Object reference not set to an instance of an object.



I'm training on Asp.net MVC5. and I did the follow.



Model Name is Movie, with code as below.,


namespace mvc1.Models
{
public class Movie
{
public int Id { get; set; }
public string Name { get; set; }

}



And a Controller with name 'MoviesConroller'. and a using statement "using mvc1.Models".


public ActionResult Random()
{

var movie = new Movie() { Name = "Star Trek!" };
return View();
}



And a View with name Random


@model mvc1.Models.Movie
@{
ViewBag.Title = "Random";
Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@Model.Name</h2>



and this is the error i get
Error









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Zx7IC8
Yv Ih7pwzuIzv,b8toG0CCQ9

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications