Howdy,
I'm not sure if you can use custom attibutes, plus everything must
compileable in order to use intelli sense with Profile property. Anyway i
prepared a working example so you can figure out what's wrong with your code.
-- mycustomprovider.vb (in app_code folder)
Imports Microsoft.VisualBasic
Imports System.Web.Profile
Imports System.Configuration
Public Class MyProfileProvider
Inherits ProfileProvider
Public Overrides Property ApplicationName() As String
Get
Return Nothing
End Get
Set(ByVal value As String)
End Set
End Property
Public Property ConnectionStringName() As String
Get
Return Nothing
End Get
Set(ByVal value As String)
End Set
End Property
Public Overrides Function DeleteInactiveProfiles(ByVal authenticationOption
As System.Web.Profile.ProfileAuthenticationOption, ByVal
userInactiveSinceDate As Date) As Integer
End Function
Public Overloads Overrides Function DeleteProfiles(ByVal usernames() As
String) As Integer
End Function
Public Overloads Overrides Function DeleteProfiles(ByVal profiles As
System.Web.Profile.ProfileInfoCollection) As Integer
End Function
Public Overrides Function FindInactiveProfilesByUserName(ByVal
authenticationOption As System.Web.Profile.ProfileAuthenticationOption, ByVal
usernameToMatch As String, ByVal userInactiveSinceDate As Date, ByVal
pageIndex As Integer, ByVal pageSize As Integer, ByRef totalRecords As
Integer) As System.Web.Profile.ProfileInfoCollection
Return Nothing
End Function
Public Overrides Function FindProfilesByUserName(ByVal authenticationOption
As System.Web.Profile.ProfileAuthenticationOption, ByVal usernameToMatch As
String, ByVal pageIndex As Integer, ByVal pageSize As Integer, ByRef
totalRecords As Integer) As System.Web.Profile.ProfileInfoCollection
Return Nothing
End Function
Public Overrides Function GetAllInactiveProfiles(ByVal authenticationOption
As System.Web.Profile.ProfileAuthenticationOption, ByVal
userInactiveSinceDate As Date, ByVal pageIndex As Integer, ByVal pageSize As
Integer, ByRef totalRecords As Integer) As
System.Web.Profile.ProfileInfoCollection
Return Nothing
End Function
Public Overrides Function GetAllProfiles(ByVal authenticationOption As
System.Web.Profile.ProfileAuthenticationOption, ByVal pageIndex As Integer,
ByVal pageSize As Integer, ByRef totalRecords As Integer) As
System.Web.Profile.ProfileInfoCollection
Return Nothing
End Function
Public Overrides Function GetNumberOfInactiveProfiles(ByVal
authenticationOption As System.Web.Profile.ProfileAuthenticationOption, ByVal
userInactiveSinceDate As Date) As Integer
End Function
Public Overrides Function GetPropertyValues(ByVal context As
System.Configuration.SettingsContext, ByVal collection As
System.Configuration.SettingsPropertyCollection) As
System.Configuration.SettingsPropertyValueCollecti on
Dim result As New System.Configuration.SettingsPropertyValueCollecti on()
For Each settings As System.Configuration.SettingsProperty In collection
result.Add(New SettingsPropertyValue(settings))
Next
Return result
End Function
Public Overrides Sub SetPropertyValues(ByVal context As
System.Configuration.SettingsContext, ByVal collection As
System.Configuration.SettingsPropertyValueCollecti on)
End Sub
End Class
-- end mycustomprovider.vb --
-- web config --
<profile defaultProvider="MyProfileProvider" enabled="true">
<providers>
<add name="MyProfileProvider" type="MyProfileProvider"/>
</providers>
<properties>
<add name="Country" type="String"/>
</properties>
</profile>
-- end web.config --
Hope this helps
Milosz
"Kirk" wrote:
I have successfully, implemented a custom Membership Provider to a SQL
2000 table, however, I am having problems doing the same with a
Profile Provider.
As I understand it, the steps for both of these are similar: Create a
new class (MyMembershipProvider and MyProfileProvider). Add the
"Inherits..." value to the provider (MembershipProvider and
ProfileProvider). Modify the web.config file to assign this class and
it's connection string. (Feel free to correct me if the above is
incorrect).
I have done this for my Profile Provider, and I can't seem to "wire
up" the new class to the application. My class starts like this:
Public Class MyProfileProvider
Inherits ProfileProvider
When I type the above inherits statement, all of the methods for this
class show up, which leads me to believe this part worked. I then
modified my web.config file like this:
<profile enabled="true" defaultProvider="MyProfileProvider" >
<providers>
<add name="MyProfileProvider" type="MyProfileProvider"
connectionStringName="Data Source=myweb;Initial
Catalog=WebReport;Persist Security Info=True;User
ID=VBUser;Password=VBUser" providername="System.Data.SqlClient" />
</providers>
<properties>
<add name="Country" type="string"/>
<add name="Gender" type="string"/>
<add name="Age" type="Int32"/>
</properties>
</profile>
In theory, I should be able to type "Profile.Country = ..." in VB and
get intellisense, right? When I type this, it tells me that "Country"
is not a member of "Profile"?
Am I missing an Imports statement or something else minor? I would
GREATLY appreciate any suggestions or comments. Thank you!