Creating a user profile

N

NickP

Hi there,

I have authentication setup on a web application that I have created
using the standard asp.net login controls.

I would like to extend the profile of users so that I can store an extra
property for each one. So far I have added the following section to my
web.config file,

<profile enabled="true">
<properties>
<add name="myproperty" type="string"/>
</properties>
</profile>

I have also added the following lines to the my new user registration
page,

Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e
As System.EventArgs) Handles CreateUserWizard1.CreatedUser
Dim pPCnProfile As ProfileCommon =
ProfileCommon.Create(CreateUserWizard1.UserName, True)
pPCnProfile.myproperty = "UNSET"
Call pPCnProfile.Save()
End Sub

Unfortunately when the account is created I now recieve the following
error message,

"An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections."

Of course, the rest of the application works, so I can still log in
other users that were created prior to this profile property being
introduced. So any ideas why it can't find the database at that point?

TIA.

Nick.
 
N

NickP

Hi there,

I've managed to fix the problem by configuring the web.config file with
a profile provider,

<profile enabled="true" defaultProvider="myprovidername">
<properties>
<add name="myproperty" type="string"/>
</properties>
<providers>
<clear/>
<add name="myprovidername"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="myconnectionstring"
applicationName="myapplication"
description="SqlProfileProvider for myapplication"/>
</providers>
</profile>

Now the ProfileCommon object can locate the database :)

Nick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top