<profile><properties> with no Profile class

Discussion in 'ASP .Net' started by Steven, Oct 21, 2008.

  1. Steven

    Steven Guest

    I have the following in my web.config:
    <system.web>
    <profile defaultProvider="MyASPSqlProfileProvider" enabled="true" >
    <properties>
    <add name="FirstName" defaultValue="" type="string"/>
    <add name="MiddleInitial" defaultValue="" type="string" />
    <add name="LastName" defaultValue="" type="string"/>
    <add name="Address1" defaultValue="" type="string"/>
    <add name="Address2" defaultValue="" type="string"/>
    <add name="City" defaultValue="" type="string"/>
    <add name="State" defaultValue=""/>
    <add name="Country" defaultValue="" type="string"/>
    <add name="PostalCode" defaultValue="" type="string"/>
    <add name="Phone" defaultValue="" type="string"/>
    <add name="NewsLetterOK" defaultValue="true" type="bool"/>
    <add name="LastOrder" defaultValue="" type="System.DateTime"/>
    </properties>
    </profile>

    When I compile, I don't get a Profile class. If I try to use it anyway
    I get compiler errors. What am I doing wrong?

    Using VS2008.

    Every site I visit says you simple add <profile> with some properties
    and VS will generate the Profile class for you.

    Thanks,

    Steven
     
    Steven, Oct 21, 2008
    #1
    1. Advertising

  2. First, I must say I am not particularly fond of the default implementation
    of Profile. It is simple, but it is a tight box to fit into. It also errors
    out and forces you to play games with Temporary ASP.NET files at times, but
    deleting them generally clears things up.

    At first blush, the config looks fine. What code are you using to try to
    pull the ProfileCommon object?

    --
    Gregory A. Beamer
    MVP, MCP: +I, SE, SD, DBA

    Subscribe to my blog
    http://feeds.feedburner.com/GregoryBeamer#

    or just read it:
    http://feeds.feedburner.com/GregoryBeamer

    ********************************************
    | Think outside the box! |
    ********************************************
    "Steven" <sedison@protronix_nospam_.com> wrote in message
    news:%...
    >I have the following in my web.config:
    > <system.web>
    > <profile defaultProvider="MyASPSqlProfileProvider" enabled="true" >
    > <properties>
    > <add name="FirstName" defaultValue="" type="string"/>
    > <add name="MiddleInitial" defaultValue="" type="string" />
    > <add name="LastName" defaultValue="" type="string"/>
    > <add name="Address1" defaultValue="" type="string"/>
    > <add name="Address2" defaultValue="" type="string"/>
    > <add name="City" defaultValue="" type="string"/>
    > <add name="State" defaultValue=""/>
    > <add name="Country" defaultValue="" type="string"/>
    > <add name="PostalCode" defaultValue="" type="string"/>
    > <add name="Phone" defaultValue="" type="string"/>
    > <add name="NewsLetterOK" defaultValue="true" type="bool"/>
    > <add name="LastOrder" defaultValue="" type="System.DateTime"/>
    > </properties>
    > </profile>
    >
    > When I compile, I don't get a Profile class. If I try to use it anyway
    > I get compiler errors. What am I doing wrong?
    >
    > Using VS2008.
    >
    > Every site I visit says you simple add <profile> with some properties
    > and VS will generate the Profile class for you.
    >
    > Thanks,
    >
    > Steven
    >
    >
    >
    >
    >
     
    Gregory A. Beamer \(Cowboy\) - MVP, Oct 23, 2008
    #2
    1. Advertising

  3. Steven

    EdisonCPP Guest

    I can't even do:
    Profile.Anything

    I just want to add a couple of fields to the default user information
    in the database using CreateUserWizard and the Login control.

    I wanted to assign the values in CreateUserWizard::CreatedUser() and
    save them to the database.

    I was under the impression I could do something like:
    Profile.FirstName = txtFirstName.Text;
    Profile.Save();

    But I get no intellisense with Profile. and anything I try to do with it
    says it doesn't exist.

    I can do:
    HttpContext.Current.Profile
    but my new fields aren't in that instance.

    Have I mis-interpreted something, or just done something wrong?

    Thanks again!

    Steven

    "Gregory A. Beamer (Cowboy) - MVP" <> wrote
    in message news:%...
    > First, I must say I am not particularly fond of the default implementation
    > of Profile. It is simple, but it is a tight box to fit into. It also
    > errors out and forces you to play games with Temporary ASP.NET files at
    > times, but deleting them generally clears things up.
    >
    > At first blush, the config looks fine. What code are you using to try to
    > pull the ProfileCommon object?
    >
    > --
    > Gregory A. Beamer
    > MVP, MCP: +I, SE, SD, DBA
    >
    > Subscribe to my blog
    > http://feeds.feedburner.com/GregoryBeamer#
    >
    > or just read it:
    > http://feeds.feedburner.com/GregoryBeamer
    >
    > ********************************************
    > | Think outside the box! |
    > ********************************************
    > "Steven" <sedison@protronix_nospam_.com> wrote in message
    > news:%...
    >>I have the following in my web.config:
    >> <system.web>
    >> <profile defaultProvider="MyASPSqlProfileProvider" enabled="true" >
    >> <properties>
    >> <add name="FirstName" defaultValue="" type="string"/>
    >> <add name="MiddleInitial" defaultValue="" type="string" />
    >> <add name="LastName" defaultValue="" type="string"/>
    >> <add name="Address1" defaultValue="" type="string"/>
    >> <add name="Address2" defaultValue="" type="string"/>
    >> <add name="City" defaultValue="" type="string"/>
    >> <add name="State" defaultValue=""/>
    >> <add name="Country" defaultValue="" type="string"/>
    >> <add name="PostalCode" defaultValue="" type="string"/>
    >> <add name="Phone" defaultValue="" type="string"/>
    >> <add name="NewsLetterOK" defaultValue="true" type="bool"/>
    >> <add name="LastOrder" defaultValue="" type="System.DateTime"/>
    >> </properties>
    >> </profile>
    >>
    >> When I compile, I don't get a Profile class. If I try to use it anyway
    >> I get compiler errors. What am I doing wrong?
    >>
    >> Using VS2008.
    >>
    >> Every site I visit says you simple add <profile> with some properties
    >> and VS will generate the Profile class for you.
    >>
    >> Thanks,
    >>
    >> Steven
    >>
    >>
    >>
    >>
    >>

    >
    >
     
    EdisonCPP, Oct 24, 2008
    #3
  4. The class that holds the autogen stuff is called ProfileCommon, not Profile.
    Not sure why, but I have not looked at what is going on. You use it like
    this:

    ProfileCommon profile = (ProfileCommon)ProfileCommon.Create("UserNameHere",
    true);

    You can then get at the custom profile elements you have created.

    --
    Gregory A. Beamer
    MVP, MCP: +I, SE, SD, DBA

    Subscribe to my blog
    http://feeds.feedburner.com/GregoryBeamer#

    or just read it:
    http://feeds.feedburner.com/GregoryBeamer

    ********************************************
    | Think outside the box! |
    ********************************************
    "EdisonCPP" <> wrote in message
    news:...
    >I can't even do:
    > Profile.Anything
    >
    > I just want to add a couple of fields to the default user information
    > in the database using CreateUserWizard and the Login control.
    >
    > I wanted to assign the values in CreateUserWizard::CreatedUser() and
    > save them to the database.
    >
    > I was under the impression I could do something like:
    > Profile.FirstName = txtFirstName.Text;
    > Profile.Save();
    >
    > But I get no intellisense with Profile. and anything I try to do with it
    > says it doesn't exist.
    >
    > I can do:
    > HttpContext.Current.Profile
    > but my new fields aren't in that instance.
    >
    > Have I mis-interpreted something, or just done something wrong?
    >
    > Thanks again!
    >
    > Steven
    >
    > "Gregory A. Beamer (Cowboy) - MVP" <>
    > wrote in message news:%...
    >> First, I must say I am not particularly fond of the default
    >> implementation of Profile. It is simple, but it is a tight box to fit
    >> into. It also errors out and forces you to play games with Temporary
    >> ASP.NET files at times, but deleting them generally clears things up.
    >>
    >> At first blush, the config looks fine. What code are you using to try to
    >> pull the ProfileCommon object?
    >>
    >> --
    >> Gregory A. Beamer
    >> MVP, MCP: +I, SE, SD, DBA
    >>
    >> Subscribe to my blog
    >> http://feeds.feedburner.com/GregoryBeamer#
    >>
    >> or just read it:
    >> http://feeds.feedburner.com/GregoryBeamer
    >>
    >> ********************************************
    >> | Think outside the box! |
    >> ********************************************
    >> "Steven" <sedison@protronix_nospam_.com> wrote in message
    >> news:%...
    >>>I have the following in my web.config:
    >>> <system.web>
    >>> <profile defaultProvider="MyASPSqlProfileProvider" enabled="true" >
    >>> <properties>
    >>> <add name="FirstName" defaultValue="" type="string"/>
    >>> <add name="MiddleInitial" defaultValue="" type="string" />
    >>> <add name="LastName" defaultValue="" type="string"/>
    >>> <add name="Address1" defaultValue="" type="string"/>
    >>> <add name="Address2" defaultValue="" type="string"/>
    >>> <add name="City" defaultValue="" type="string"/>
    >>> <add name="State" defaultValue=""/>
    >>> <add name="Country" defaultValue="" type="string"/>
    >>> <add name="PostalCode" defaultValue="" type="string"/>
    >>> <add name="Phone" defaultValue="" type="string"/>
    >>> <add name="NewsLetterOK" defaultValue="true" type="bool"/>
    >>> <add name="LastOrder" defaultValue="" type="System.DateTime"/>
    >>> </properties>
    >>> </profile>
    >>>
    >>> When I compile, I don't get a Profile class. If I try to use it anyway
    >>> I get compiler errors. What am I doing wrong?
    >>>
    >>> Using VS2008.
    >>>
    >>> Every site I visit says you simple add <profile> with some properties
    >>> and VS will generate the Profile class for you.
    >>>
    >>> Thanks,
    >>>
    >>> Steven
    >>>
    >>>
    >>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Gregory A. Beamer \(Cowboy\) - MVP, Oct 24, 2008
    #4
  5. Steven

    Steven Guest

    It's so odd. I found my temporary files, and the cs files have
    the:

    protected ProfileCommon Profile {
    get {
    return ((ProfileCommon)(this.Context.Profile));
    }
    }
    for each of my files.

    And the class ProfileCommon definition file, yet in my project
    I can't seem to use ProfileCommon or Profile. They're not
    in my autocomplete, and they won't compile. The ProfileCommon
    definition file matches my web.config prefectly.

    Can I just delete my temporary files and recompile?

    Steven

    "Gregory A. Beamer (Cowboy) - MVP" <> wrote
    in message news:...
    > The class that holds the autogen stuff is called ProfileCommon, not
    > Profile. Not sure why, but I have not looked at what is going on. You use
    > it like this:
    >
    > ProfileCommon profile =
    > (ProfileCommon)ProfileCommon.Create("UserNameHere", true);
    >
    > You can then get at the custom profile elements you have created.
    >
    > --
    > Gregory A. Beamer
    > MVP, MCP: +I, SE, SD, DBA
    >
    > Subscribe to my blog
    > http://feeds.feedburner.com/GregoryBeamer#
    >
    > or just read it:
    > http://feeds.feedburner.com/GregoryBeamer
    >
    > ********************************************
    > | Think outside the box! |
    > ********************************************
    > "EdisonCPP" <> wrote in message
    > news:...
    >>I can't even do:
    >> Profile.Anything
    >>
    >> I just want to add a couple of fields to the default user information
    >> in the database using CreateUserWizard and the Login control.
    >>
    >> I wanted to assign the values in CreateUserWizard::CreatedUser() and
    >> save them to the database.
    >>
    >> I was under the impression I could do something like:
    >> Profile.FirstName = txtFirstName.Text;
    >> Profile.Save();
    >>
    >> But I get no intellisense with Profile. and anything I try to do with it
    >> says it doesn't exist.
    >>
    >> I can do:
    >> HttpContext.Current.Profile
    >> but my new fields aren't in that instance.
    >>
    >> Have I mis-interpreted something, or just done something wrong?
    >>
    >> Thanks again!
    >>
    >> Steven
    >>
    >> "Gregory A. Beamer (Cowboy) - MVP" <>
    >> wrote in message news:%...
    >>> First, I must say I am not particularly fond of the default
    >>> implementation of Profile. It is simple, but it is a tight box to fit
    >>> into. It also errors out and forces you to play games with Temporary
    >>> ASP.NET files at times, but deleting them generally clears things up.
    >>>
    >>> At first blush, the config looks fine. What code are you using to try to
    >>> pull the ProfileCommon object?
    >>>
    >>> --
    >>> Gregory A. Beamer
    >>> MVP, MCP: +I, SE, SD, DBA
    >>>
    >>> Subscribe to my blog
    >>> http://feeds.feedburner.com/GregoryBeamer#
    >>>
    >>> or just read it:
    >>> http://feeds.feedburner.com/GregoryBeamer
    >>>
    >>> ********************************************
    >>> | Think outside the box! |
    >>> ********************************************
    >>> "Steven" <sedison@protronix_nospam_.com> wrote in message
    >>> news:%...
    >>>>I have the following in my web.config:
    >>>> <system.web>
    >>>> <profile defaultProvider="MyASPSqlProfileProvider" enabled="true" >
    >>>> <properties>
    >>>> <add name="FirstName" defaultValue="" type="string"/>
    >>>> <add name="MiddleInitial" defaultValue="" type="string" />
    >>>> <add name="LastName" defaultValue="" type="string"/>
    >>>> <add name="Address1" defaultValue="" type="string"/>
    >>>> <add name="Address2" defaultValue="" type="string"/>
    >>>> <add name="City" defaultValue="" type="string"/>
    >>>> <add name="State" defaultValue=""/>
    >>>> <add name="Country" defaultValue="" type="string"/>
    >>>> <add name="PostalCode" defaultValue="" type="string"/>
    >>>> <add name="Phone" defaultValue="" type="string"/>
    >>>> <add name="NewsLetterOK" defaultValue="true" type="bool"/>
    >>>> <add name="LastOrder" defaultValue="" type="System.DateTime"/>
    >>>> </properties>
    >>>> </profile>
    >>>>
    >>>> When I compile, I don't get a Profile class. If I try to use it anyway
    >>>> I get compiler errors. What am I doing wrong?
    >>>>
    >>>> Using VS2008.
    >>>>
    >>>> Every site I visit says you simple add <profile> with some properties
    >>>> and VS will generate the Profile class for you.
    >>>>
    >>>> Thanks,
    >>>>
    >>>> Steven
    >>>>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Steven, Oct 24, 2008
    #5
  6. Steven

    Steven Guest

    I deleted my temporary files and recompiled. Still no luck.


    "Gregory A. Beamer (Cowboy) - MVP" <> wrote
    in message news:...
    > The class that holds the autogen stuff is called ProfileCommon, not
    > Profile. Not sure why, but I have not looked at what is going on. You use
    > it like this:
    >
    > ProfileCommon profile =
    > (ProfileCommon)ProfileCommon.Create("UserNameHere", true);
    >
    > You can then get at the custom profile elements you have created.
    >
    > --
    > Gregory A. Beamer
    > MVP, MCP: +I, SE, SD, DBA
    >
    > Subscribe to my blog
    > http://feeds.feedburner.com/GregoryBeamer#
    >
    > or just read it:
    > http://feeds.feedburner.com/GregoryBeamer
    >
    > ********************************************
    > | Think outside the box! |
    > ********************************************
    > "EdisonCPP" <> wrote in message
    > news:...
    >>I can't even do:
    >> Profile.Anything
    >>
    >> I just want to add a couple of fields to the default user information
    >> in the database using CreateUserWizard and the Login control.
    >>
    >> I wanted to assign the values in CreateUserWizard::CreatedUser() and
    >> save them to the database.
    >>
    >> I was under the impression I could do something like:
    >> Profile.FirstName = txtFirstName.Text;
    >> Profile.Save();
    >>
    >> But I get no intellisense with Profile. and anything I try to do with it
    >> says it doesn't exist.
    >>
    >> I can do:
    >> HttpContext.Current.Profile
    >> but my new fields aren't in that instance.
    >>
    >> Have I mis-interpreted something, or just done something wrong?
    >>
    >> Thanks again!
    >>
    >> Steven
    >>
    >> "Gregory A. Beamer (Cowboy) - MVP" <>
    >> wrote in message news:%...
    >>> First, I must say I am not particularly fond of the default
    >>> implementation of Profile. It is simple, but it is a tight box to fit
    >>> into. It also errors out and forces you to play games with Temporary
    >>> ASP.NET files at times, but deleting them generally clears things up.
    >>>
    >>> At first blush, the config looks fine. What code are you using to try to
    >>> pull the ProfileCommon object?
    >>>
    >>> --
    >>> Gregory A. Beamer
    >>> MVP, MCP: +I, SE, SD, DBA
    >>>
    >>> Subscribe to my blog
    >>> http://feeds.feedburner.com/GregoryBeamer#
    >>>
    >>> or just read it:
    >>> http://feeds.feedburner.com/GregoryBeamer
    >>>
    >>> ********************************************
    >>> | Think outside the box! |
    >>> ********************************************
    >>> "Steven" <sedison@protronix_nospam_.com> wrote in message
    >>> news:%...
    >>>>I have the following in my web.config:
    >>>> <system.web>
    >>>> <profile defaultProvider="MyASPSqlProfileProvider" enabled="true" >
    >>>> <properties>
    >>>> <add name="FirstName" defaultValue="" type="string"/>
    >>>> <add name="MiddleInitial" defaultValue="" type="string" />
    >>>> <add name="LastName" defaultValue="" type="string"/>
    >>>> <add name="Address1" defaultValue="" type="string"/>
    >>>> <add name="Address2" defaultValue="" type="string"/>
    >>>> <add name="City" defaultValue="" type="string"/>
    >>>> <add name="State" defaultValue=""/>
    >>>> <add name="Country" defaultValue="" type="string"/>
    >>>> <add name="PostalCode" defaultValue="" type="string"/>
    >>>> <add name="Phone" defaultValue="" type="string"/>
    >>>> <add name="NewsLetterOK" defaultValue="true" type="bool"/>
    >>>> <add name="LastOrder" defaultValue="" type="System.DateTime"/>
    >>>> </properties>
    >>>> </profile>
    >>>>
    >>>> When I compile, I don't get a Profile class. If I try to use it anyway
    >>>> I get compiler errors. What am I doing wrong?
    >>>>
    >>>> Using VS2008.
    >>>>
    >>>> Every site I visit says you simple add <profile> with some properties
    >>>> and VS will generate the Profile class for you.
    >>>>
    >>>> Thanks,
    >>>>
    >>>> Steven
    >>>>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Steven, Oct 24, 2008
    #6
    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?aGlra2s=?=

    binding profile properties in Gridview ??

    =?Utf-8?B?aGlra2s=?=, Aug 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    811
    Brock Allen
    Aug 8, 2005
  2. Brad
    Replies:
    1
    Views:
    1,174
    Roedy Green
    Jul 19, 2005
  3. E11
    Replies:
    1
    Views:
    4,938
    Thomas Weidenfeller
    Oct 12, 2005
  4. Andy B
    Replies:
    0
    Views:
    554
    Andy B
    May 3, 2008
  5. SuperZE
    Replies:
    5
    Views:
    363
    SuperZE
    Oct 6, 2008
Loading...

Share This Page