Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lars 66 posts 136 karma points
    Jun 04, 2016 @ 09:38
    Lars
    0

    Hi. I have a Umbraco 7 working fine locally in Visual Studio. I have a MVC form working fine as well. However when I upload the MVC form to my web hotel I get the error:

    Exception Details: System.InvalidOperationException: No route in the route table matches the supplied values.
    

    The error comes from the line calling my MVC controller:

     @Html.Action("Index", "ContactFormSurface")
    

    I have installed Umbraco at the web hotel separately meaning no upload of the main Umbraco files.

    But I am stucked. I guess that the answer is simple since I have no big experience with the MVC. Maybe something's wrong with the namespace, maybe somthing else is not working. But any help will be highly appreciated :-)

    The top code in my controller is:

    using Agnieszka.ViewModels;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using Umbraco.Core.Models;
    using Umbraco.Web.Mvc;
    
    using Umbraco.Web.Mvc.UmbracoTemplatePage;
    using Umbraco.Web.Routing;
    
    namespace Agnieszka.Controllers
    {
        public class ContactFormSurfaceController : Umbraco.Web.Mvc.SurfaceController
        {
            // GET: ContactFormSurface
    
            public ActionResult Index()
            {
                return PartialView("ContactForm", new ContactFormViewModel());
            }
    

    // Lars

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jul 03, 2016 @ 10:00
    Alex Skrypnyk
    0

    Hi Lars,

    Umbraco uses it's own routing. You don't need to use controllers for rendering partial view. Try to use Html helper:

    @Html.Partial("ContactForm")

    But you need to create new model inside partial view - new ContactFormViewModel()

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft