c# - ProfileCommon in WAP working at run-time but not at compile-time -
i have web application project , implemented profile properties in web.config. when found couldn't access profilecommon
object googled , found workarounds:
- how list of user/profile membership provider?
- how assign profile values?
- "the name profilecommon not exist in current context"
- http://forums.asp.net/t/1487719.aspx/1?profile+common+non+existant+in+asp+net+4+0+
- http://weblogs.asp.net/jgalloway/archive/2008/01/19/writing-a-custom-asp-net-profile-class.aspx
and on. nobody said have profilecommon
object @ run-time. here's example:
<profile enabled="true"> <properties> <add name="adminremark"/> <add name="facilityid" type="system.int64" defaultvalue="1"/> </properties> </profile>
this line compiles , works, have hard-coded property name:
rcbfacilityid.selectedvalue = (profilebase.create(usercurrent.username) profilebase) .getpropertyvalue("facilityid").tostring();
but line doesn't compile , gives error: type or namespace name 'profilecommon' not found (are missing using directive or assembly reference?)):
rcbfacilityid.selectedvalue = (profilebase.create(usercurrent.username) profilecommon) .facilityid.tostring();
but @ run-time tried execute line in visual studio watch window , worked! event displayed type of profilebase.create(usercurrent.username)
profilecommon
without cast. intellisense didn't work, inspect object , saw had both profile properties defined.
i don't mind working hard-coded profile property names if it's way except custom profilecommon
class, i'd explanation why profilecommon
class available @ run-time , not compile-time?
profilecommon not available @ compile time because class created when application started. due properties can define inside profile element in web.config can dynamically added. see remarks in official documentation.
Comments
Post a Comment