Contour Submit doesn't work - "Cannot perform runtime binding on a null reference" server error
Hi, I just installed "Contour" in umbraco and on form submit this error appears below:
umbraco version 6.1.6
Server Error in '/' Application.
Cannot perform runtime binding on
a null reference
Description:
An
unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where it
originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException:
Cannot perform runtime binding on a null reference
Source Error:
An unhandled exception was
generated during the execution of the current web request. Information
regarding the origin and location of the exception can be identified using
the exception stack trace below.
Stack Trace:
[RuntimeBinderException:
Cannot perform runtime binding on a null reference]
Could not find a Surface controller route in the RouteTable for controller name FormRender
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Could not find a Surface controller route in the RouteTable for controller name FormRender
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Could not find a Surface controller route in the RouteTable for controller name FormRender]
Contour Submit doesn't work - "Cannot perform runtime binding on a null reference" server error
Hi, I just installed "Contour" in umbraco and on form submit this error appears below:
umbraco version 6.1.6
Server Error in '/' Application.
Cannot perform runtime binding on a null reference
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[RuntimeBinderException: Cannot perform runtime binding on a null reference]
CallSite.Target(Closure , CallSite , Object ) +200
System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +912
Umbraco.Forms.Mvc.Controllers.FormRenderController.ContourForm(FormViewModel model, Boolean captchaIsValid) in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.Mvc\Controllers\FormRenderController.cs:208
lambda_method(Closure , ControllerBase , Object[] ) +167
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +248
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10() +120
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +637
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +637
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +637
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +272
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +714
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +40
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +596
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +305
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18056
Please help,
boris
Hi Boris and welcome to our :)
What version of the MVC framework do you have installed?
/Jan
mvc 4.5
Can anyone help, what can cause this error to appear?
Update:
Found the problem behind the error, in the global.asax we have a custom Route:
RouteTable.Routes.MapRoute(
name: "SiteNavigationProvider",
url: "mvc/{controller}/{action}/{id}",
defaults: new { action = "Index", id = UrlParameter.Optional });
if i remove it, the submit button works.
After founding the problem i found this bug:
http://issues.umbraco.org/issue/CON-252
I tried the solution there, but got an error:
Server Error in '/' Application.
Could not find a Surface controller route in the RouteTable for controller name FormRender
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Could not find a Surface controller route in the RouteTable for controller name FormRender
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Could not find a Surface controller route in the RouteTable for controller name FormRender]
Umbraco.Web.Mvc.RenderRouteHandler.HandlePostedValues(RequestContext requestContext, PostedDataProxyInfo postedInfo) +509
System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +12681399
Umbraco.Web.UmbracoModule.ProcessRequest(HttpContextBase httpContext) +509
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18067
How can i use my custom routing and making contour to work?
Does anyone has found a solution on that? I am facing the same issue. I have custom routes, I followed the solution on the bug
http://issues.umbraco.org/issue/CON-252
and I am getting the same error as boris is getting.
I think I have found a solution which is to modify the umbraco\plugins\umbracoContour\views\form.cshtml to render the form tag differently:
COMMENT OUT THE FOLLOWING LINE:
using (Html.BeginForm("ContourForm", "FormRender", FormMethod.Post, new { enctype = "multipart/form-data" }))
AND USE INSTEAD:
@using (Html.BeginForm())
is working on a reply...