Creating a user profile

Discussion in 'ASP .Net Security' started by NickP, Dec 7, 2007.

  1. NickP

    NickP Guest

    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.
    NickP, Dec 7, 2007
    #1
    1. Advertising

  2. NickP

    NickP Guest

    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" <> wrote in message
    news:...
    > 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.
    >
    NickP, Dec 7, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Qmhhc2thcg==?=
    Replies:
    1
    Views:
    543
    Bruce Barker
    Dec 10, 2005
  2. Brad
    Replies:
    1
    Views:
    1,134
    Roedy Green
    Jul 19, 2005
  3. Andy B
    Replies:
    0
    Views:
    517
    Andy B
    May 3, 2008
  4. Steven
    Replies:
    5
    Views:
    481
    Steven
    Oct 24, 2008
  5. Andy Fish

    creating a user profile for the aspnet user

    Andy Fish, Oct 29, 2004, in forum: ASP .Net Security
    Replies:
    2
    Views:
    175
    Andy Fish
    Nov 1, 2004
Loading...

Share This Page