Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9136425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:57:03+00:00 2026-06-17T08:57:03+00:00

Web.config: <profile enabled=true defaultProvider=DefaultProfileProvider> <providers> <add name=DefaultProfileProvider inherits=XCSN.Models.WebProfile type=System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 connectionStringName=DefaultConnection

  • 0

Web.config:

<profile enabled="true" defaultProvider="DefaultProfileProvider">
  <providers>
    <add name="DefaultProfileProvider" inherits="XCSN.Models.WebProfile" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
</profile>

Creating a user, trying to assign firstname and lastname properties in profile:

    [Authorize(Roles = "Manager")]
    [HttpPost]
    public ActionResult Register(RegisterModel model)
    {
        if (ModelState.IsValid)
        {
            // Attempt to register the user
            MembershipCreateStatus createStatus;

            Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

            if (createStatus == MembershipCreateStatus.Success)
            {
                Roles.AddUserToRole(model.UserName, model.Role);

                //add profile information
                var profile = WebProfile.GetProfile(model.UserName);
                profile.FirstName = model.FirstName;
                profile.LastName = model.LastName;
                profile.Save();

                return RedirectToAction("Index", "Account");
            }
            else
            {
                ModelState.AddModelError("", ErrorCodeToString(createStatus));
            }
        }

        ViewBag.RolesList = Roles.GetAllRoles().Select(x => new SelectListItem { Text = x, Value = x });
        // If we got this far, something failed, redisplay form
        return View(model);
    }


public class WebProfile : ProfileBase
{
    [Display(Name = "First Name")]
    public virtual string FirstName
    {
        get
        {
            return (this.GetPropertyValue("FirstName").ToString());
        }
        set
        {
            this.SetPropertyValue("FirstName", value);
        }
    }

    [Display(Name = "Last Name")]
    public virtual string LastName
    {
        get
        {
            return (this.GetPropertyValue("LastName").ToString());
        }
        set
        {
            this.SetPropertyValue("LastName", value);
        }
    }

    public static WebProfile GetProfile(string username)
    {
        return Create(username) as WebProfile;
    }
}

it fails on this line: profile.FirstName = model.FirstName;
WebProfile.GetProfile(model.UserName); returns null and I don’t understand why.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:57:03+00:00Added an answer on June 17, 2026 at 8:57 am

    inherits=”XCSN.Models.WebProfile” should be in the tag, not the tag.

    like this:

    <profile inherits="XCSN.Models.WebProfile" enabled="true" defaultProvider="DefaultProfileProvider">
      <providers>
        <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
      </providers>
    </profile>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following in my web.config: <profile enabled=true> <providers> ... <add name=Phone
at web.config <section name=FlowWebDataProviders type=FlowWebProvidersSection requirePermission=false/> <FlowWebDataProviders peopleProviderName=sqlProvider IzmListProviderName=sqlProvider> <PeopleProviders> <add name=sqlProvider type=SqlPeopleProvider connectionStringName=FlowServerConnectionString/>
when I add this code to my root web.config under system.web <profile> <properties> <add
In my Web.config, under <system.web> , I have: <caching> <outputCacheSettings> <outputCacheProfiles> <add name=Cache60Seconds location=ServerAndClient
For my ASP.NET MVC 3 app (using Razor) my web.config has this: <profile> <providers>
When the following profile section is in my web.config, the first page request fail
I have a List<> as part of a users profile stroed in the web.config
I am trying to implement a custom profile class in C# that inherits System.Web.Profile.ProfileBase.
I have a Web Application Project and implemented profile properties in the web.config. When
Here is my Web.config file: <?xml version=1.0?> <configuration> <system.web> <customErrors mode=Off /> <compilation debug=true

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.