第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何分配配置文件值?

如何分配配置文件值?

白豬掌柜的 2019-07-01 16:38:42
如何分配配置文件值?我不知道我缺少什么,但我在Web.config文件中添加了配置文件屬性,但無法訪問配置文件。項(xiàng)目在代碼中或創(chuàng)建一個新的配置文件。
查看完整描述

3 回答

?
慕碼人8056858

TA貢獻(xiàn)1803條經(jīng)驗(yàn) 獲得超6個贊

概要文件也可以用于Web應(yīng)用程序項(xiàng)目。這些屬性可以在設(shè)計時在Web.config中定義,也可以編程方式定義。在Web.config中:

<profile enabled="true" automaticSaveEnabled="true" defaultProvider="AspNetSqlProfileProvider">
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="TestRolesNProfiles"/>
      </providers>
      <properties>
        <add name="FirstName"/>
        <add name="LastName"/>
        <add name ="Street"/>
        <add name="Address2"/>
        <add name="City"/>
        <add name="ZIP"/>
        <add name="HomePhone"/>
        <add name="MobilePhone"/>
        <add name="DOB"/>

      </properties>
    </profile>

或以編程方式,通過實(shí)例化剖面圖并使用ProfilePropertySettingsProfilePropertySettingCollege,它們都在System.Web.ConfigurationNamesspace中。若要使用配置文件的這些屬性,請使用System.Web.Profile.ProfileBase對象。無法訪問配置文件屬性。側(cè)寫。語法,但可以通過實(shí)例化ProfileBase并使用SetPropertyValue("PropertyName“)和GetPropertyValue{"PropertyName“)如下:

ProfileBase curProfile = ProfileBase.Create("MyName");

或訪問當(dāng)前用戶的配置文件:

ProfileBase curProfile = ProfileBase.Create(System.Web.Security.Membership.GetUser().UserName);



        curProfile.SetPropertyValue("FirstName", this.txtName.Text);
        curProfile.SetPropertyValue("LastName", this.txtLname.Text);
        curProfile.SetPropertyValue("Street", this.txtStreet.Text);
        curProfile.SetPropertyValue("Address2", this.txtAdd2.Text);
        curProfile.SetPropertyValue("ZIP", this.txtZip.Text);
        curProfile.SetPropertyValue("MobilePhone", txtMphone.Text);
        curProfile.SetPropertyValue("HomePhone", txtHphone.Text);
        curProfile.SetPropertyValue("DOB", txtDob.Text);
        curProfile.Save();


查看完整回答
反對 回復(fù) 2019-07-01
  • 3 回答
  • 0 關(guān)注
  • 480 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號