2010-03-10 63 views
1

海代碼,我沒有收到「配置文件」屬性在後面

我增加了一些配置文件屬性到我的web.config:

<profile automaticSaveEnabled ="true"> 
     <properties> 
      <add name="NumVisits" type="System.Int32"/> 
      <add name="UserName" type="System.String"/> 
      <add name="Gender" type="bool"/> 
      <add name="Birthday" type="System.DateTime"/> 
     </properties> 
     </profile> 

然而,當我嘗試訪問財產它後面的代碼不存在 。下面的代碼不起作用(說firstname是不屬性):

Profile.Gender 而在Asp.net配置'配置文件選項卡'沒有顯示。 我已經重建瞭解決方案。我正在使用VB.NET(3.5)

回答

0

檢索配置文件屬性值的另一種方法如下所示。

object obj = HttpContext.Current.Profile [「PropertyName」]; (C#代碼)。

+0

我曾經見過類似'Profile.Gender'的東西。 – 2010-03-10 10:46:07

+0

請參閱http://www.codeguru.com/csharp/.net/net_asp/controls/article.php/c10179 – 2010-03-10 11:00:34

相關問題