2010-11-04 95 views
1

我想根據這個帖子來使用使用VB.NET在ASP.NET中的自定義配置文件: How to assign Profile values?自定義配置文件asp.net

我創建的文件夾/class/Usuario.vb下我的個人資料類使用Locus命名空間。該類繼承了上面post中指定的ProfileBase。

的問題是,當我試圖讓我的web.config中那類的引用,它給了我此錯誤消息:

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?) 

這是我怎樣,我宣佈我的web.config:

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

的「繼承」的部分是什麼失敗

我試着用搜索引擎,但我無法得到它的工作

我做錯了什麼線索?

提前致謝!

編輯:這是類的代碼:

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 Property 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 

末命名空間

回答

0

已添加到web.config中您的自定義命名空間的引用?

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

我還沒有添加一個自定義的命名空間,但我有一個答案,我張貼回來 – Arturo 2010-11-04 20:18:56

1

我的命名空間之前添加的項目名稱和固定的問題,somethint這樣的:

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

現在我測試的配置文件,但對於現在的IIS是不扔的錯誤和編譯成功。

謝謝,我希望這可以幫助別人