Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8393011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:40:29+00:00 2026-06-09T19:40:29+00:00

I am trying to learn ASP.Net MVC from the asp.net website sample application MVCMovieApplication

  • 0

I am trying to learn ASP.Net MVC from the asp.net website sample application MVCMovieApplication. This application was written for MVC3. I am stuck at the below part. Can someone help me with this issue?

public ActionResult Edit(int id = 0)
{
    Movie movie = db.Movies.Find(id);
    if (movie == null)
    {
        return HttpNotFound();
    }
    return View(movie);
}

Error:

The Name 'HTTPNotFound' does not exist in the current context.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:40:31+00:00Added an answer on June 9, 2026 at 7:40 pm

    The HttpNotFound method and the related HttpStatusCodeResult and it’s inheritors like HttpNotFoundResult are new features added in MVC3. That why it’s not working in MVC2.

    So either you upgrade to MVC3 (even MVC4 is released as RTM as of this week)

    or you can create your own ActionResult to return the 404 status code:

    public class HttpNotFoundResult : ActionResult
    {
        private const int NotFoundCode = 404;
    
        public override void ExecuteResult(ControllerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
    
            context.HttpContext.Response.StatusCode = NotFoundCode;
        }
    }
    

    And you in your action method:

    public ActionResult Edit(int id = 0)
    {
        Movie movie = db.Movies.Find(id);
        if (movie == null)
        {
            return new HttpNotFoundResult();
        }
        return View(movie);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to download some ASP.NET MVC Sample application to learn MVC. I
I am trying to learn Asp.net Mvc so I am trying out this Tutorial.
I am trying to learn MVC using ASP.NET MVC3. Most of the tutorials I
I am trying to learn Asp.net mvc. I know its different from forms and
I'm trying to learn ASP.NET MVC, so I did as test project this where
I am trying to learn ASP.NET MVC and I hit this problem: I have
I am trying to learn ASP.NET MVC by porting my current app written in
I'm trying to learn ASP.NET MVC 3 coming from a web forms background. I'm
I am trying to learn asp.net MVC and having an issue to submit a
I'm trying to learn ASP.NET MVC + Entity Framework by developing a small project.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.