Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created the class and added the reference in web.config file as follows. The sample is working in vs2008 but not in vs2010 can u you please help out by posting the response in [email removed]

C#
namespace LD.Sample.BLL
{
    using System;

    [Serializable]
    public class Personal
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
     //   public DateTime DateOfBirth { get; set; }
    }
}

namespace LD.Sample.BLL
{
   using System.Web;
   using System.Web.Profile;

   public class CustomProfile : ProfileBase
   {
      public Personal Personal
      {
         get { return (Personal) GetPropertyValue("Personal"); }
      }

      /// <summary>
      /// Get the profile of the currently logged-on user.
      /// </summary>      
      public static CustomProfile GetProfile()
      {
         return (CustomProfile) HttpContext.Current.Profile;
      }

      /// <summary>
      /// Gets the profile of a specific user.
      /// </summary>
      /// <param name="userName">The user name of the user whose profile you want to retrieve.</param>
      public static CustomProfile GetProfile(string userName)
      {
         return (CustomProfile) Create(userName);
      }
   }
}


web.config

<profile defaultprovider="LD.SampleWAP.ProfileProvider" 
        inherits="LD.Sample.BLL.CustomProfile">
    <providers>
           <add name="LD.SampleWAP.ProfileProvider">
                type="System.Web.Profile.SqlProfileProvider"
                applicationName="/"
                connectionStringName="LocalSqlServer" />
    </providers>
</profile>
Posted
Updated 29-Nov-10 1:42am
v5
Comments
#realJSOP 29-Nov-10 7:38am    
When someone responds to your message, you will automatically get an email at the address you used to register on CodeProject. DO NOT include your email address in articles, tips, or messages posted here.
[no name] 29-Nov-10 8:30am    
What part is not working in 2010? You need to give a little more detail if you expect an answer.

1 solution

I would suggest that if the code is unchanged between studio 2008 and 2010, ensure that you are still targeting the same dotNet version. If at that point the project doesn't compile, we can help you with the build errors themselves. From the code you have provided, I don't see anything glaring that is wrong. (At least not without a more intimate knowledge of the underlying classes)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900