Using Profiles in ASP.NET
Im new to using Profiles in vb.net and trying to figure out what im doing wrong. In webconfig开发者_如何学JAVA I have the following code:
And in my vb code i'm trying to add to the profile by using this code:
profile.FirstName = "John"
But I keep getting an error saying:
FirstName is not a member of profile.
Is there something im doing wrong?. I am trying to learn this through reading this book but it seems like there missing a step. Any help would be very much appreciated.
Make sure you define a ProfileProvider in your Web.Config such as SqlProfileProvider or the Table Profile Provider
Here an example, replace the YOURConnectionString
and YOURApplicationName
with string you use.
<profile defaultProvider="CustomProfileProvider" enabled="true">
<providers>
<add name="CustomProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="YOURConnectionString"
applicationName="YOURApplicationName"
description="Something" />
</providers>
<properties>
<add name="FirstName" type="System.String"/>
</properties>
</profile>
You could also read this Article
精彩评论