c# - MVC5 get profile from custom membership -


i'm trying use ´profile´ variable using mvc5 , custom profile

web.config

<authentication mode="forms">       <forms loginurl="~/account/login" timeout="2880" enablecrossappredirects="true" />     </authentication>     <sessionstate mode="sqlserver" allowcustomsqldatabase="true" sqlconnectionstring="data source=190.160.10.3;initial catalog=eagencia;user id=sa;password=nopass" cookieless="false" timeout="60" />     <rolemanager enabled="true" defaultprovider="customizedroleprovider">       <providers>         <add name="customizedroleprovider" type="system.web.security.sqlroleprovider" connectionstringname="userauthentication" applicationname="isessions" />       </providers>     </rolemanager>     <membership defaultprovider="customizedmembershipprovider">       <providers>         <add name="customizedmembershipprovider" type="system.web.security.sqlmembershipprovider" passwordformat="clear" connectionstringname="userauthentication" applicationname="isessions" requiresuniqueemail="false" maxinvalidpasswordattempts="5" minrequiredpasswordlength="6" minrequirednonalphanumericcharacters="0" />       </providers>     </membership>     <profile enabled="true" defaultprovider="tableprofileprovider">       <providers>         <clear />         <add name="tableprofileprovider" type="microsoft.samples.sqltableprofileprovider" connectionstringname="userauthentication" table="aspnet_customprofile" applicationname="isessions" />         <add name="storedprocedureprofileprovider" type="microsoft.samples.sqlstoredprocedureprofileprovider" connectionstringname="userauthentication" setprocedure="setcustomprofiledata" readprocedure="getcustomprofiledata" applicationname="databaseprofileprovidertest" />       </providers>       <properties>         <!-- config retrive table provider -->         <add name="memberid" type="int" customproviderdata="memberid;int" />         <add name="nombres" type="string" defaultvalue="[null]" customproviderdata="names;varchar" />         <add name="lastnames" type="string" defaultvalue="[null]" customproviderdata="lastnames;varchar" />         <add name="cod_emp" type="int" defaultvalue="[null]" customproviderdata="cod_emp;int" />       </properties>     </profile> 

accountcontroller

[httppost]         [allowanonymous]         [validateantiforgerytoken]         public actionresult login(loginviewmodel model, string returnurl)         {             if (modelstate.isvalid)             {                 if (membership.validateuser(model.username, model.password))                 {                     formsauthentication.setauthcookie(model.username, model.rememberme);                      if (url.islocalurl(returnurl))                         return (actionresult)redirect(returnurl);;                      return url.islocalurl(returnurl)                                ? (actionresult)redirect(returnurl)                                : redirecttoaction("index", "home");                 }                 modelstate.addmodelerror("", "el usuario o contraseña utilizados son incorrectos.");             }              return view(model);         } 

but, when try ´profile´ using ´c#´ get:

profile 'profile' threw exception of type 'system.configuration.configurationerrorsexception' system.web.profile.profilebase {system.configuration.configurationerrorsexception}

in ´mvc4´ code works, using ´mvc5´ profile variable, gets error.

how can profile using custom membership?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -