HighTechTalks DotNet Forums  

Creating a user profile

ASP.net Security microsoft.public.dotnet.framework.aspnet.security


Discuss Creating a user profile in the ASP.net Security forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
NickP
 
Posts: n/a

Default Creating a user profile - 12-07-2007 , 04:45 AM






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.



Reply With Quote
  #2  
Old   
NickP
 
Posts: n/a

Default Re: Creating a user profile - 12-07-2007 , 07:58 AM






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.

"NickP" <a@a.com> wrote

Quote:
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.




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.