Problem when creating Profilecommon

Asked

Viewed 32 times

0

inserir a descrição da imagem aqui

I have the following problem when creating my profile, someone can help me in what may be happening?

My web Config is configured as follows.

<profile defaultProvider="AspNetSqlProfileProvider">
  <providers>
    <clear />
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" applicationName="/Usuarios" connectionStringName="labPuc" />
  </providers>
  <properties>
    <add name="UserId" type="System.Guid" />
    <add name="Nome" type="System.String" />
    <add name="TipoPermissao" type="System.String" />
    <add name="Email" type="System.String" />
    <add name="Habilitado" type="System.String" />
  </properties>
</profile>

1 answer

1

This code would never work. Here you override the perfil mounted via Linq:

perfil = (ProfileCommon) Create(userName, true);

The right thing would be to keep only the Linq sentence. That line I highlighted can be removed.

  • More when I get the profile it comes empty. Profilecommon profile = (Profilecommon)Httpcontext.Current.Profile; Alias gives the same error.

  • From what I realized my Context and my username and the other properties come empty. Does it have something to do?

  • Like I told you, you need to return one ProfileCommon filled with the desired properties. Either you keep Linq and return the mounted object by it, omitting the line I put in the answer, or you fill an object by Linq, call the line and change the line object with Linq’s return.

  • This question deserves to be here @Gypsy? 2 years and only 25 hits!:)

  • I find the question excellent. Pity that the approach of Profiles is little explored.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.