开发者

custom profile asp.net

I'm trying to use a custom profile in ASP.NET using VB.NET according to this post: How to assign Profile values?

I created my profile class under the folder /class/Usuario.vb using the Locus namespace. The class inherits ProfileBase as specified in the post above.

The problem is that when I try to make a reference to that class on my web.config it gives me this error message:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
Compiler Error Message: CS0246: The type or namespace name 'Locus' could not be found (are you missing a using directive or an assembly reference?)

This is how I'm declaring my web.config:

  <profile defaultProvider="CustomizedProfileProvider" inherits="Locus.Usuario">
    <providers>
      <clear />
        <add name="CustomizedProfileProvider"
             type="System.Web.Profile.SqlProfileProvider"
             connectionStringName="BDSIT" />          
    </providers>
  </profile>   

The "inherits" part is what's failing

I tried googling but I couldn't get it working

Any clues on what am I doing wrong?

Thanks in advance!

EDIT: This is the code of the class:

Namespace Locus
Public Class Usuario
    Inherits ProfileBase

    Public ReadOnly Property UsuarioActual() As Usuario
        Get
            Return ProfileBase.Create(Membership.GetUser.UserName)
        End Get
    End Property

    Public Pro开发者_如何学Goperty nombre() As String
        Get
            Return Me.GetPropertyValue("nombre")
        End Get
        Set(ByVal value As String)
            Me.SetPropertyValue("nombre", value)
            Save()
        End Set
    End Property

    Public Property apellido() As String
        Get
            Return Me.GetPropertyValue("apellido")
        End Get
        Set(ByVal value As String)
            Me.SetPropertyValue("apellido", value)
            Save()
        End Set
    End Property

    Public Property pin() As String
        Get
            Return Me.GetPropertyValue("pin")
        End Get
        Set(ByVal value As String)
            Me.SetPropertyValue("pin", value)
            Save()
        End Set
    End Property

End Class

End Namespace


I added the project name before the Namespace and that fixed the issue, somethint like this:

<profile defaultProvider="CustomizedProfileProvider" inherits="ProjectName.Locus.Usuario">

I'm now testing the profile but for now the IIS is not throwing the error and the compilation succeeds.

Thanks, I hope this helps someone


Have you added a reference to your custom namespace in web.config?

<namespaces>
<add namespace="Locus" />
</namespace>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜