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

  • Home
  • SEARCH
  • 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 7611849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:45:52+00:00 2026-05-31T01:45:52+00:00

I have made e installation with Umbraco version 5 and I am making a

  • 0

I have made e installation with Umbraco version 5 and I am making a form with Surface Controller. I added the form in a view like that:

@inherits RenderViewPage
@using System.Web.Mvc.Html;
@using Umbraco.Cms.Web;
@using Umbraco.Cms.Web.Editors;
@{
    Layout = "Page.cshtml";
}

<section>
  @using (Html.BeginUmbracoForm("SendContactInfo", "ContactSurface"))
  {

      var contactForm = new ContactModel();


    @Html.ValidationSummary(prefix: "contactForm")

    @Html.EditorFor(x => contactForm)


    <input type="submit"  value="Send" />
  }
</section>

and Controller:

public class ContactSurfaceController:SurfaceController
{
    [HttpPost]
    public ActionResult SendContactInfo(
        [Bind(Prefix = "contactForm")]
            ContactModel model)
    {
        if (!ModelState.IsValid)
        {
            return CurrentUmbracoPage();
        }


        return new JsonResult() { Data = new { Name = "Sucess!"} };
    }
}

And Model:

public class ContactModel
{
    public string FirstName { get; set; }

    public string LastName { get; set; }

    [Required]
    public string Email { get; set; }

    public string Message { get; set; }
}

And I get a Null reference exception at @Html.EditorFor(x => contactForm). This is the stack trance:

[NullReferenceException: Object reference not set to an instance of an object.]


Umbraco.Framework.Localization.Web.Mvc.LocalizingModelMetadataProvider.GetConventionKeyNames(Type containerType, String propertyName, Boolean testSimplePropertyName) +285
   Umbraco.Framework.Localization.Web.Mvc.LocalizingModelMetadataProvider.CreateMetadata(IEnumerable`1 attributes, Type containerType, Func`1 modelAccessor, Type modelType, String propertyName) +597
   Umbraco.Cms.Web.Mvc.Metadata.UmbracoModelMetadataProvider.CreateMetadata(IEnumerable`1 attributes, Type containerType, Func`1 modelAccessor, Type modelType, String propertyName) +62
   System.Web.Mvc.AssociatedMetadataProvider.GetMetadataForProperty(Func`1 modelAccessor, Type containerType, PropertyDescriptor propertyDescriptor) +93
   System.Web.Mvc.<GetMetadataForPropertiesImpl>d__2.MoveNext() +226
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +217
   System.Linq.<GetEnumerator>d__0.MoveNext() +96
   System.Linq.WhereEnumerableIterator`1.MoveNext() +87
   System.Web.Mvc.Html.DefaultEditorTemplates.ObjectTemplate(HtmlHelper html, TemplateHelperDelegate templateHelper) +368
   System.Web.Mvc.Html.DefaultEditorTemplates.ObjectTemplate(HtmlHelper html) +47
   System.Web.Mvc.Html.TemplateHelpers.ExecuteTemplate(HtmlHelper html, ViewDataDictionary viewData, String templateName, DataBoundControlMode mode, GetViewNamesDelegate getViewNames, GetDefaultActionsDelegate getDefaultActions) +714
   System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(HtmlHelper html, ModelMetadata metadata, String htmlFieldName, String templateName, DataBoundControlMode mode, Object additionalViewData, ExecuteTemplateDelegate executeTemplate) +1117
   System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(HtmlHelper html, ModelMetadata metadata, String htmlFieldName, String templateName, DataBoundControlMode mode, Object additionalViewData) +66
   System.Web.Mvc.Html.TemplateHelpers.TemplateFor(HtmlHelper`1 html, Expression`1 expression, String templateName, String htmlFieldName, DataBoundControlMode mode, Object additionalViewData, TemplateHelperDelegate templateHelper) +117
   System.Web.Mvc.Html.TemplateHelpers.TemplateFor(HtmlHelper`1 html, Expression`1 expression, String templateName, String htmlFieldName, DataBoundControlMode mode, Object additionalViewData) +100
   System.Web.Mvc.Html.EditorExtensions.EditorFor(HtmlHelper`1 html, Expression`1 expression) +56
   ASP._Page_Views_Umbraco_contact_cshtml.Execute() in e:\3fa4128e3b304b75b56af47f1ff5219e\Umbraco5-Smallsite\Views\Umbraco\contact.cshtml:17
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
   System.Web.WebPages.StartPage.RunPage() +19
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +65
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
   System.Web.Mvc.Controller.ExecuteCore() +116
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8969117
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

I’ve been struggling with this error for 4-5 hours, googling and trying different things. If anyone has an idea how to fix this I would be very grateful.

Update
I’ve posted the whole code of the view and the controller for more info.

Update-2
Added the model for more info.

Update-3
Finally I used the approach suggested in the two posts below. The problem I was having with the approach was that I added the SurfaceController directly in Umbraco’s website instead of making another project and referencing it in Umbraco’s website. When I created the separate project – Controller Showed Up and everything was fine. I am marking the post that let me to that thought as the right answer.

I couldn’t resolve the problem with the exception in Umbraco’s localization thought.

You can find the source code about this thread at the GitHub repository.

  • 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-31T01:45:54+00:00Added an answer on May 31, 2026 at 1:45 am

    Assuming you’re posting the complete code of your view your view is not strongly typed and missing a model causing the EditorFor to throw an exception. Just add the model directive to your view and from your controller push in an object into the view:

    @model Site.Extensions.ViewModel.ContactViewModel
    
            [ChildActionOnly]
        public PartialViewResult ContactForm()
        {
            var model = new ContactViewModel();
            return PartialView(model);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a SVG image, or more like mini application, for viewing graphs
I have made a class which a form can inherit from and it handles
I have setup a simplesaml installation and configured my sources, I made themes for
I have installation solution that have installer project (not web installer but simple installer)
I have a default installation of Tomcat 6.0, and I have an app that
I have an installer that I would like to use for a major upgrade.
I have a website (http://nottingham.subverb.net) that is mainly made up of messy procedural code
I have created a module that works on a vanilla installation of Drupal but
I have a Windows application based on Java, that I should like to install
I have made a new project in a clean eclipse installation and imported a

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.