locked
view is not found when i use html.BeginForm RRS feed

  • Question

  • User1398839915 posted

    _Layout.cshtml:

    <li>@Html.ActionLink("Add", "AddShop", "Home")</li>


    Home Controller:

    [HttpPost]
            public ActionResult AddShop(ShopDetail shop)
            {
                somecode
    
                return View();
            }

    AddShop.cshtml:

    <div class="container">
    
        @using (Html.BeginForm("AddShop", "Home", FormMethod.Post))
        {
    some code
        }
    </div>

    Routeconfig:

    routes.MapRoute(
                    name: "Default",
                    url: "{controller}/{action}/{id}",
                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );

    Please help. when i try to call Index/AddShop it gives 404 error.

    Monday, July 6, 2020 9:48 AM

Answers