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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -