Implementing Profile Provider in ASP.NET MVC

Here’s what you need to do:

1) In Web.config’s section, add “inherits” attribute in addition to your other attribute settings:

<profile inherits="MySite.Models.ProfileCommon" defaultProvider="....

2) Remove entire <properties> section from Web.config, since you have already defined them in your custom ProfileCommon class and also instructed to inherit from your custom class in previous step

3) Change the code of your ProfileCommon.GetProfile() method to

public virtual ProfileCommon GetProfile(string username)        
{            
     return Create(username) as ProfileCommon;      
}

Hope this helps.

Leave a Comment