Copied to clipboard

Flag this post as spam?

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


  • Denis Semyonov 1 post 21 karma points
    Jun 18, 2012 @ 10:47
    Denis Semyonov
    0

    RegisterModel works incorrectly in case of post form

    Hi developers,

    Now I am trying to create register form for new members in Umbraco 5.1. I use these code in template feature.chtml:

    @inherits RenderViewPage
    @using System.Web.Mvc.Html;
    @using Umbraco.Cms.Web;
    @{
        Layout = "_Layout.cshtml";
        var formModel = new Umbraco.Cms.Web.UI.Models.RegisterModel();
        formModel.MemberTypeAlias = "client";
    }

    @section PageTitle
    {
        @CurrentPage.Name
    }
    <p>@Html.Raw(@CurrentPage.content)</p>

    <h2>Register form</h2>
    @Html.Partial("RegisterPartial", formModel)

    The register form is shown correctly. But if I try to send form, I see there error:

    Value cannot be null.
    Parameter name: sourceId

    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.ArgumentNullException: Value cannot be null.
    Parameter name: sourceId

    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:

    [ArgumentNullException: Value cannot be null.
    Parameter name: sourceId]
       Umbraco.Framework.Mandate.That(Boolean condition, Func`2 defer) +34
       Umbraco.Framework.Persistence.Model.Associations._Revised.RelationById..ctor(HiveId sourceId, HiveId destinationId, AbstractRelationType relationType, Int32 ordinal, RelationMetaDatum[] metaData) +630
       Umbraco.Framework.Security.MembershipService`2.Create(TUserType user, MembershipCreateStatus& status) +2909
       Umbraco.Cms.Web.UI.Controllers.AuthSurfaceController.RegisterForm(RegisterModel model) +667
       lambda_method(Closure , ControllerBase , Object[] ) +127
       System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
       System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +129
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +826266
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +826266
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +826266
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314
       System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +825488
       System.Web.Mvc.Controller.ExecuteCore() +159
       System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
       System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
       System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
       System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

    What did I do wrong?

    Note: in fact a member is created with correct type = "client".

Please Sign in or register to post replies

Write your reply to:

Draft