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 6940793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:47:55+00:00 2026-05-27T12:47:55+00:00

Hi! i try to learn Asp.net MVC.i created a sample application to learn it.

  • 0

Hi! i try to learn Asp.net MVC.i created a sample application to learn it. But press f5 return server error. Where do l make a mistake? where is the problem? there is a navigator bar Home/About/Product . if i press Product, error return to me.

enter image description here
Cotroller:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication1.Models.Db;

namespace MvcApplication1.Controllers
{
    public class ProductsController : Controller
    {
        //
        // GET: /Products/

        public ActionResult GetAll()
        {
            using (var ctx = new MyDbEntities())
            {
                ViewData["Products"] = ctx.Products;
                return View();
            }

        }

    }
}

View:


<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication1.Models.Db.Product>" %>
<%@ Import Namespace="MvcApplication1.Models.Db" %>
<%@ Import Namespace="MvcApplication1.Controllers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    ProductDetail
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>ProductDetail</h2>
    <ul>

<% foreach (var m in (IEnumerable<Products>)ViewData["Products"])
     { %>

     <li><%= m.ProductName %></li>

<% } %>
</ul>

</asp:Content>

site.Master:



            <div id="menucontainer">

                <ul id="menu">              
                    <li><%: Html.ActionLink("Home", "Index", "Home")%></li>
                    <li><%: Html.ActionLink("About", "About", "Home")%></li>
                     <li><%: Html.ActionLink("Product", "ProductDetail", "Product")%></li>
                </ul>

            </div>
  • 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-05-27T12:47:56+00:00Added an answer on May 27, 2026 at 12:47 pm
    <%: Html.ActionLink("Product", "ProductDetail", "Product")%>
    

    the action name ProductDetail is not in your controller you have GetAll action name

    u need

     public ActionResult ProductDetail()
        {
            using (var db = new NorthwindEntities())
            {
                return View(db.Products.ToList());
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi; i am a Asp.net software developer. i try to learn asp.net mvc. But
i try to learn asp.net Profile management. But i added below xml firstName,LastName and
I am following along with the music store example to try learn ASP.NET MVC.
My application is modelled after NerdDinner presented in http://www.asp.net/mvc/learn/ . I am having problem
I am trying to learn Asp.net Mvc so I am trying out this Tutorial.
i using word press, and i try to learn it, but is see the
I am working on an ASP.NET MVC web application, and am working on the
I'm making an extremely simple CMS in ASP.NET MVC 3 (just to learn it)
I'm trying to learn a bit of ASP.net MVC 3 and I'm facing a
I'm trying to learn the charting control in asp.net, but I am having some

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.