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:

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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -