Can not finish membership signin with membership not set.

Jul 16, 2013 at 1:43 PM
Hi,

I am attempting to use a single sign on solution between my website and an instance of near forums. For my website I am using ASP.NET MVC 4 with Entity Framework and the Code First Membership provider.

The error occurs, after I login on my website and try to use the forum so it is clear that the near forums instance is having issues with finding the current user.

If anyone could point me in the right direction that would really help! or Is it quite simply that I can't do SSO with Code First Membership provider?

Thanks

J Spencer

Here is a stack trace of the error supplied
[ArgumentNullException: Value cannot be null.
Parameter name: Can not finish membership signin with membership not set.]
NearForums.Web.Controllers.Helpers.SecurityHelper.TryFinishMembershipLogin(SessionWrapper session, MembershipUser membershipUser, IUsersService service) +310
NearForums.Web.Controllers.Filters.ContextAuthenticationAttribute.OnActionExecuting(ActionExecutingContext filterContext) +278
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +72
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func
1 continuation) +727142
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +727142
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func
1 continuation) +727142
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters) +309
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +727076
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +334
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +52
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Jul 17, 2013 at 2:53 PM
Just to clear this up for anyone else that might be having the same issue!

The problem was being caused because I was referencing my main projects .dll in the forum instance and within this my data context had the overload on the constructor set to pick up the default connection string, which wasn't present in my forum instances web.config. adding this to the forum instance resolved my problem.

Cheers,

J Spencer
Coordinator
Jul 17, 2013 at 3:05 PM
Thanks for the info!!!
Dec 10, 2013 at 11:38 AM
Edited Dec 10, 2013 at 11:38 AM
I am getting "Value cannot be null.
Parameter name: Can not finish membership signin with membership not set."

in TryFinishMembershipLogin also.

I do not understand why, I have spent a few hours on it and I am totally stuck. I am not logged in so I do not understand why it thinks membershipUser should not be null.

membershipUser SHOULD be null because I am not logged in!

WTF?
Dec 10, 2013 at 12:04 PM
It looks like if you are trying to run from source code, you have to setup in IIS. You can not just "Set Startup Project" and hit run or you get "Can not finish membership signin with membership not set."