Copied to clipboard

Flag this post as spam?

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


  • Mike Stokes 2 posts 52 karma points
    Sep 06, 2013 @ 05:54
    Mike Stokes
    0

    Contour Error on Submit - Value cannot be null. Parameter name: username

    We are experiencing the following bug when a user submits a Contour form (Umbraco 6.03 and Contour 3.0.12):

    Value cannot be null. Parameter name: username

    We are using Claims based authentication and authorization (ADFS 2.0) and everything works great except this problem that occurs only for logged in users.  Users who are not logged in can submit Contour forms correctly.

    Check the trace logs and no luck.  If we attach the Visual Studio debugger, the exception is thrown in the assembly Umbraco.Form.Mvc.Bridge when it calls Html.RenderMvcAction

    We've checked the trace logs and no luch (just warnings there).

    Thanks for any help - much appreciated.

    Mike

  • Comment author was deleted

    Sep 11, 2013 @ 15:58

    Mind posting the strack trace then I can take a look where this is happening

  • Mike Stokes 2 posts 52 karma points
    Sep 11, 2013 @ 22:11
    Mike Stokes
    100

    Thank you - we have solved the problem, I'll include the solution below for anyone else who comes across this issue:

    When using claims authentication (vis ADFS 2.0) in Umbraco 6 and .Net 4.5, the claims returned by ADFS only included a login-id and no other information.  To resolve the login-id to e-mail, name etc we need to calll a REST Contact service.  We wrote a ClaimsAuthenticationManager class to call the Contact service and populate the results as additional claims in the session.

    The problem was that we were not specifically setting the Name claim - e.g.:

    ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim(ClaimTypes.Name, contact.Name));

    Setting this claim also sets the User.Identity.Name in the HttpContext and the current Thread which is what is needed, as it appears the User.Identity.Name being null was the cause of this error.  Setting this claim solved the probem.

  • Comment author was deleted

    Sep 12, 2013 @ 09:30

    Ok thanks for posting the solution :)

Please Sign in or register to post replies

Write your reply to:

Draft