asp.net mvc 3 - Custom membership provider get current login user -
i have little problem, implement own membership provider , works fine. added userid articles code in controller:
[httppost, authorize, validateinput(false)]         public actionresult vytvorit(article newarticle)         {             if(modelstate.isvalid){                     if(!user.identity.isauthenticated)                     return view(newarticle);                 newarticle.user.userid = (int)membership.getuser().provideruserkey;              repo.save(newarticle);             return redirecttoaction("zobrazit", new {id=newarticle.articleid});             }             return view(newarticle);         }   and working after many changes (in controllers, models , so) tried , there problem membership.getuser returns null.
i tried google , found there might problem authenticated user can't found in membership datasource. dont know how fix it.
thanks
edit: mymembershipprovider
don't know if found useful tutorial when putting custom membership provider recently.
http://theintegrity.co.uk/2010/11/asp-net-mvc-2-custom-membership-provider-tutorial-part-1/
Comments
Post a Comment