assign value to profile?

Last post 07-05-2009 6:45 PM by ronald_yoh. 3 replies.

Sort Posts:

  • assign value to profile?

    07-04-2009, 2:14 AM
    • Member
      80 point Member
    • ronald_yoh
    • Member since 10-27-2008, 2:37 AM
    • Posts 303

    hi there,


    i'm not sure if i'm doing it the right way or not.. but i have the following profile in web.config:


    <profile enabled="true">
          <properties>
            <add name="ServiceSessionId" allowAnonymous="true"/>
          </properties>
        </profile>


    and i try to assign a value in one of the button click event as follow:

    protected void Button2_Click(object sender, EventArgs e)
            {
                
                HttpContext.Current.Profile["ServiceSessionId"] = "Hello World";
    
            }


    but i'm getting an error : "Cannot connect to SQL database" at line "HttpContext.Current.Profile["ServiceSessionId"] = "Hello World";"


    can anyone help?

  • Change your profile setting

    07-04-2009, 4:11 AM
    Answer
    • Contributor
      5,178 point Contributor
    • sukumarraju
    • Member since 06-14-2006, 6:01 PM
    • Scotland, UK
    • Posts 1,132

    ronald_yoh:
    <profile enabled="true">
          <properties>
            <add name="ServiceSessionId" allowAnonymous="true"/>
          </properties>
        </profile>
     

    • Looking at the error implies your profile setting is looking for the data store.

    Change your web.config profile setting similar to  below.

    <profile defaultProvider="AspNetSqlProfileProvider">
      <properties>
         <add name="Name" />
         <add name="Weight" type="System.Int32" />
         <add name="BirthDate" type="System.DateTime" />
      </properties>
    </profile>
    You may check various <profile> properties here.
    

    Let me know further Queries.

    -- "Mark As Answer" if my reply helped you --
    Recommended Book
    Application Architecture Guide 2.0
    My Blog
  • Re: assign value to profile?

    07-04-2009, 4:26 AM
    Answer

     Check this .. same issue .

    http://forums.asp.net/t/1337875.aspx


    Plz remember to click "Mark as Answer" if this helped you.

    Abdulla AbdelHaq    MCTS, MCPD

    - My Articles on ASP Alliance
    - My Weblogs
    - My Sessions on JorDev User Group

    "Experience is simply the name we give our mistakes"
  • Re: assign value to profile?

    07-05-2009, 6:45 PM
    • Member
      80 point Member
    • ronald_yoh
    • Member since 10-27-2008, 2:37 AM
    • Posts 303

    hi all.. thanks for your suggestions.. but i haven't really tested what you have suggested due to tight deadline on my projects.. at the moment i'm using the session as the temporary solution and replacement to profile.

    i will try what you have suggested and will surely mark as answer if your suggestion is truely what i'm looking for.

Page 1 of 1 (4 items)