Unable to retrieve profile info

Discussion in 'ASP .Net' started by =?Utf-8?B?QXNobGV5IEJyeWFudA==?=, Apr 6, 2006.

  1. I'm just starting my first 2.0 site with the new membership features and am
    having some trouble with profiles. I have my providers set up and working
    fine and profile data is being written to the database. However, I can't
    retrieve any of the stored profile values on my site. I set up the provider
    and everything just like it is explained in the various MSDN articles, but
    still nothing.

    Any thoughts?
     
    =?Utf-8?B?QXNobGV5IEJyeWFudA==?=, Apr 6, 2006
    #1
    1. Advertising

  2. Hi Ashley,

    How are you writing profile data to the database, is it through the
    Page.Profile object? When you try to retrieve you profile data, do the
    profile fields you configured in web.config appear under Intellisense?

    Chris
     
    Chris Fulstow, Apr 6, 2006
    #2
    1. Advertising

  3. I'm writing the values through a click handler like this:

    profile.DisplayName = txtDisplayName.Text

    The data is making it to the database just fine, but doesn't come back when
    I make a call to profile.DisplayName

    DisplayName does show up under Intellisense when I type in "profile".

    "Chris Fulstow" wrote:

    > Hi Ashley,
    >
    > How are you writing profile data to the database, is it through the
    > Page.Profile object? When you try to retrieve you profile data, do the
    > profile fields you configured in web.config appear under Intellisense?
    >
    > Chris
    >
    >
     
    =?Utf-8?B?QXNobGV5IEJyeWFudA==?=, Apr 6, 2006
    #3
  4. In which event handler are you trying to read the profile values?
     
    Chris Fulstow, Apr 6, 2006
    #4
  5. =?Utf-8?B?QXNobGV5IEJyeWFudA==?=

    tdavisjr Guest

    Isn't it Profile.DisplayName (with a capital "P")

    If your using VB then I don't think it makes much of a difference; but
    this is the only thing I can think of.
     
    tdavisjr, Apr 6, 2006
    #5
  6. I just made a simple form with a textbox and a button. When the button is
    clicked it fires the click handler and apparently does the update because the
    database is correct.

    "Chris Fulstow" wrote:

    > In which event handler are you trying to read the profile values?
    >
    >
     
    =?Utf-8?B?QXNobGV5IEJyeWFudA==?=, Apr 6, 2006
    #6
  7. I'm using VB, so it shouldn't matter.

    "tdavisjr" wrote:

    > Isn't it Profile.DisplayName (with a capital "P")
    >
    > If your using VB then I don't think it makes much of a difference; but
    > this is the only thing I can think of.
    >
    >
     
    =?Utf-8?B?QXNobGV5IEJyeWFudA==?=, Apr 6, 2006
    #7
  8. Do you get IntelliSense for your profile properties when you set the
    value, or do you need to type it manually? Can you see the profile
    data in the database, or is it just the profile table structure?
     
    Chris Fulstow, Apr 6, 2006
    #8
  9. Yes, I get the Intellisense for the profile entry I created. The profile
    data does get written to the database. Everything is happening the way it's
    supposed to except for when I actually try and display the profile data
    somewhere.

    So, on the form I created to change the Display name I have this in my
    Page_Load:

    If Not Page.IsPostBack then
    txtDisplayName.Text = profile.DisplayName
    End If

    And the click handler has only this:

    profile.DisplayName = txtDisplayName.Text

    The txtDisplayName textbox never has the existing profile in it on page
    load, nor do any of the other pages where I attempt to call
    profile.DisplayName.

    "Chris Fulstow" wrote:

    > Do you get IntelliSense for your profile properties when you set the
    > value, or do you need to type it manually? Can you see the profile
    > data in the database, or is it just the profile table structure?
    >
    >
     
    =?Utf-8?B?QXNobGV5IEJyeWFudA==?=, Apr 6, 2006
    #9
  10. All looks ok, what have you got in the <profile> section of your
    web.config? Are you using some sort of authentication or is it
    anonymous users?
     
    Chris Fulstow, Apr 6, 2006
    #10
  11. Anonymous users can't even reach the form for setting a DisplayName.

    I'm at work right now and don't have access to my Web.config file directly,
    so I'll do my best to reproduce the profile section from memory:

    <profile enabled="true" providerName="sqlProfileProvider">
    <providers>
    <clear/>
    <add name="sqlProfileProvider" connectionString="TNSDB" />
    </providers>
    <properties>
    <add name="DisplayName" type="System.String" />
    </properties>
    </profile>

    "Chris Fulstow" wrote:

    > All looks ok, what have you got in the <profile> section of your
    > web.config? Are you using some sort of authentication or is it
    > anonymous users?
    >
    >
     
    =?Utf-8?B?QXNobGV5IEJyeWFudA==?=, Apr 6, 2006
    #11
  12. It seems a bit weird that IntelliSense shows your profile properties in
    the button click handler, but not in the page load handler? Both
    methods should be referencing the same Page object with the same
    properties.

    Can you read the profile property in the button click handler, as well
    as write it?
     
    Chris Fulstow, Apr 7, 2006
    #12
  13. Oh, it gets weirder...

    I put in a msgbox to tell me what the value of profile.DisplayName is right
    before I do profile.DisplayName = txtDisplayName.Text and it shows me the
    right value.

    I also set up a label on the page that gets it's value from the
    profile.DisplayName as well during the page_load. Same deal here as with the
    textbox though, in that the value isn't there until after the submit button
    is clicked.

    "Chris Fulstow" wrote:

    > It seems a bit weird that IntelliSense shows your profile properties in
    > the button click handler, but not in the page load handler? Both
    > methods should be referencing the same Page object with the same
    > properties.
    >
    > Can you read the profile property in the button click handler, as well
    > as write it?
    >
    >
     
    =?Utf-8?B?QXNobGV5IEJyeWFudA==?=, Apr 7, 2006
    #13
  14. Chris Fulstow, Apr 11, 2006
    #14
    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?Wnd5YXR0?=

    size of Profile Info in SqlProfileProvider?

    =?Utf-8?B?Wnd5YXR0?=, Sep 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    597
    Cowboy \(Gregory A. Beamer\)
    Sep 25, 2004
  2. SR
    Replies:
    0
    Views:
    359
  3. Brad
    Replies:
    1
    Views:
    1,161
    Roedy Green
    Jul 19, 2005
  4. Andy B
    Replies:
    0
    Views:
    547
    Andy B
    May 3, 2008
  5. Steven
    Replies:
    5
    Views:
    505
    Steven
    Oct 24, 2008
Loading...

Share This Page