Question Configuring and Saving Profiles in a Web Application

njsokalski

Well-known member
Joined
Mar 16, 2011
Messages
102
Programming Experience
5-10
I am working on adding the ASP.NET Profile feature to my Web Application, and am having trouble getting it to communicate with the database. I have the Membership feature configured and working, and I ran the tool on the database to do the necessary configuration for Profiles as well. I have a class that inherits from ProfileBase as follows:

Public Class MPProfile : Inherits System.Web.Profile.ProfileBase

End Class

And my Web.config includes the following:

<profile enabled="true" inherits="mckeepottery_com.MPProfile" defaultProvider="McKeePotteryProfileProvider" automaticSaveEnabled="true">
<providers>
<clear/>
<add name="McKeePotteryProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="SqlServerConnection"/>
</providers>
</profile>

I have tried to get it to save stuff by using the following line in my *.master page:

Public Property Profile As MPProfile = CType(HttpContext.Current.Profile, MPProfile)

And accessing it using:

Me.Master.Profile

I have even tried using the statement:

Me.Master.Profile.Save()

To explicitly save it, but that didn't make any difference either (although I don't think you're supposed to need to call Save() manually, anyway). I have read a lot about Profiles being available only in Web Sites and not Web Applications, so I used everything I could find in all those articles on how to use Profiles in Web Applications, but still no luck. I'm sure I'm just missing something stupid (it always is, isn't it?), but I'm not sure where to go next. Can anybody help me? Thanks.
 

Latest posts

Back
Top