Profile example


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //In web.config:
  2. <profile inherits="Our365Insurance.Domain.ApplicantProfile, Our365Insurance.Domain" defaultProvider="Our365ProfileProvider" enabled="true" automaticSaveEnabled="false">
  3. <providers>
  4. <clear/>
  5. <add name="Our365ProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="AspNetConnectionString" description="Stores and retrieves profile data from the local Microsoft SQL Server database"/>
  6. </providers>
  7. <properties>
  8. <clear/>
  9. <add name="SmartNavigatorProvider" allowAnonymous="true" serializeAs="String" type="String"/>
  10. <add name="HighestSequenceCompleted" allowAnonymous="true" serializeAs="String" type="Int32"/>
  11. <add name="ApplicationID" allowAnonymous="true" serializeAs="String" type="System.Guid"/>
  12. <add name="IsMemberSelectedByUser" allowAnonymous="true" serializeAs="String" type="Boolean" />
  13. </properties>
  14. </profile>
  15.  
  16.  
  17. //And in C# domain object:
  18. #region Using Directives
  19.  
  20. using System;
  21. using System.Web.Profile;
  22. using Our365Insurance.Domain.Enums;
  23.  
  24. #endregion
  25.  
  26. namespace Our365Insurance.Domain
  27. {
  28. /// <summary>
  29. /// This class is the custom ASP.NET Membership Profile, which provides access
  30. /// to the entire object model.
  31. /// </summary>
  32. [Serializable]
  33. public class ApplicantProfile : ProfileBase
  34. {
  35. /// <summary>
  36. /// Gets and sets the option for submitting/filing a request for coverage.
  37. /// </summary>
  38. [SettingsAllowAnonymous(true)]
  39. public FilingOption FilingOption
  40. {
  41. get
  42. {
  43. return (FilingOption)Enum.Parse(typeof(FilingOption), base.GetPropertyValue("FilingOption").ToString());
  44. }
  45.  
  46. set
  47. {
  48. base.SetPropertyValue("FilingOption", value);
  49. }
  50. }
  51.  
  52. [SettingsAllowAnonymous(true)]
  53. public Member Member
  54. {
  55. get
  56. {
  57. return (Member)base.GetPropertyValue("Member");
  58. }
  59.  
  60. set
  61. {
  62. base.SetPropertyValue("Member", value);
  63. }
  64. }
  65. }
  66. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.