Accessing Profile from a Server Control

Last post 10-21-2005 5:26 PM by chadgei. 3 replies.

Sort Posts:

  • Accessing Profile from a Server Control

    09-26-2005, 6:11 AM
    • Member
      10 point Member
    • Paul.W
    • Member since 09-26-2005, 9:50 AM
    • London
    • Posts 2
    I have created a new Server Control which inherits from System.Web.UI.Control, and overrides CreateChildControls().

    But I am unable to access the Profile. Should this be possible?
  • Re: Accessing Profile from a Server Control

    09-26-2005, 11:44 AM
    • Member
      10 point Member
    • Paul.W
    • Member since 09-26-2005, 9:50 AM
    • London
    • Posts 2
    I have managed to access the Profile by using HTTPContext.Current.Profile...

    Thanks anyway.
  • Re: Accessing Profile from a Server Control

    09-30-2005, 6:40 PM
    • Member
      5 point Member
    • luhar
    • Member since 09-30-2005, 10:36 PM
    • Posts 1
    I have control deriving from System.Web.UI.WebControls. While i do see Profile exposed as HttpContext.Current.Profile, it does not expose the profile properties as stronglytyped accesssor properties. I can use Profile.GetPropertyValue to get the value of the property but would prefer to use the strongly types accessor.
    Any idea why this is happenning?

    Thanks,
    Luhar
    JaySaiom
  • Re: Accessing Profile from a Server Control

    10-21-2005, 5:26 PM
    • Member
      187 point Member
    • chadgei
    • Member since 12-08-2004, 5:48 AM
    • South Dakota
    • Posts 38
    I don't know if this is correct, but I use it.  Just cast HttpContext.Current.Profile to ProfileBase and you will have access to your strongly-typed profile properties.  Like this:
    ((ProfileBase)HttpContext.Current.Profile).ProfileProperty1

    Hope that helps.
      --  chad

Page 1 of 1 (4 items)