Properties defined under a group name in Web.config file - ASP.NET Security

Q.  The following group profile properties defined under a group name in Web.config file. How will you access Street and City property?

<properties>
<group name="Address">
<add name="Street" />
<add name="City" />
</group>
</properties>

- Published on 28 Jul 15

a. - Profile.name.Street
 - Profile.name.City
b. - Profile.Address.Street
 - Profile.Address.City
c. - Address.Street
 - Address.City
d. None of the above.

ANSWER: - Profile.Address.Street
 - Profile.Address.City
 

    Discussion

  • Raj Singh   -Posted on 16 Sep 15
    In many applications, user wants to store and use information that is unique that user. Using profiles we can remember the user between visits and display the appropriate information to him. You can also create group of set of properties in web.config file.
    In the above question you can access the profile properties as:
    Profile.Address.Street
    Profile.Address.City
    Here Profile is the property of HttpContext Class and Address is the name of group.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)