开发者

I am not getting the 'Profile' property in the code behind

开发者 https://www.devze.com 2022-12-22 17:08 出处:网络
hai , I have added some profile properties to my web.config: <profile automaticSaveEnabled =\"true\">

hai ,

I have added some profile properties to my 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>

However when I try to access the property in a code behind it does not exist. The following code does not work (says firstname is not a开发者_如何转开发 property):

Profile.Gender And In the Asp.net Configuration 'Profile tab ' Is not showing. I have rebuilt the solution. I am using VB.NET(3.5)


Another way to retrieve Profile properties value is like below.

object obj = HttpContext.Current.Profile["PropertyName"]; (C# code).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号