Code Life

--Joy Code

用户操作
[即时聊天] [发私信] [加为好友]
fei hanID:applelure
10723次访问,排名10373(2)好友5人,关注者5
applelure的文章
原创 7 篇
翻译 0 篇
转载 38 篇
评论 2 篇
applelure的公告

Locations of visitors to this page
最近评论
zhh0086:谢谢了了了了
lxdff:
---------------------------------
Silverlight中文社区
www.silverlight.cn
---------------------------------
文章分类
收藏
    相册
    BLOG
    _________
    downthemall
    Google Blog
    Sohu Blog.
    中国博客网BLOG
    你听我说
    博客园的BLOG
    DotNet
    【孟宪会之精彩世界】
    WiKi
    ITwiki it百科
    维客WiKi
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    转载 用profile存储用户信息收藏

    新一篇: 关于App_Offline.htm | 旧一篇: 微软推出Popfly,一个面向大众的基于Silverlight的web mashup builder应用


    利用profile添加额外的用户信息
    1.在web.config中添加如下信息
    <profile enabled="true">
        <properties>
          <add name="Country" type="string"/>
          <add name="Gender" type="string"/>
          <add name="Age" type="Int32"/>
        </properties>
    </profile>

    </connectionStrings>

    <system.web>

    <anonymousIdentification enabled="true" />

    <profile defaultProvider="MyProfileProvider">

    <providers>

    <add

    name="MyProfileProvider"

    type="System.Web.Profile.SqlProfileProvider"

    connectionStringName="myConnectionString" />

    </providers>

    <properties>

    <add

    name="FirstName"

    allowAnonymous="true" />

    <add

    name="LastName"

    allowAnonymous="true" />

    </properties>

    </profile>

    </system.web>

    </configuration>


    其中properties中的为所需的用户信息字段

    2.在创建用户基本信息完成之后,创建额外的用户信息profile,profilecommon是根据上面config中的那段自动生成的类
    // CreatedUser event is called when a new user is successfully created
    public void CreateUserWizard1_CreatedUser(object sender, EventArgs e) {
     
       // Create an empty Profile for the newly created user
       ProfileCommon p = (ProfileCommon) ProfileCommon.Create(CreateUserWizard1.UserName, true);
     
       // Populate some Profile properties off of the create user wizard
       p.Country = ((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Country")).SelectedValue;
       p.Gender = ((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Gender")).SelectedValue;
       p.Age = Int32.Parse(((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Age")).Text);
     
       // Save profile - must be done since we explicitly created it
       p.Save();

    发表于 @ 2007年05月25日 21:42:00|评论(loading...)|编辑

    新一篇: 关于App_Offline.htm | 旧一篇: 微软推出Popfly,一个面向大众的基于Silverlight的web mashup builder应用

    评论:没有评论。

    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © applelure