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 7074941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:07:05+00:00 2026-05-28T06:07:05+00:00

I have an MVC3 site and I am writing code to register a user.

  • 0

I have an MVC3 site and I am writing code to register a user. The code does this:

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

The next thing it does is this:

HttpContext.Profile["FirstNAme"] = model.FirstName;
HttpContext.Profile["LastName"] = model.LastName;

This is where it fails. The error I get is:

This property cannot be set for anonymous users.

I understand why; it is because there is no user logged in or no user specified, so of course I can’t set the profile for the user. I am working from page 754 onwards of Pro ASP.NET MVC 3 Framework and this is where I got this code from. I have set this up in the web.config file.

<profile enabled="true" defaultProvider="AspNetSqlProfileProvider">
  <providers>
    <clear/>
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
  </providers>
  <properties>
    <add name="FirstName" type="String"/>
    <add name="LastName" type="String"/>
  </properties>
</profile>

My question is how do I set the first name and last name of the user I am trying to register?

  • 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-05-28T06:07:06+00:00Added an answer on May 28, 2026 at 6:07 am

    Try getting the profile for that user’s username by:

    ProfileBase profile = ProfileBase.Create(model.UserName);
    

    Yes, create ‘gets’ the profile for the user you just created, not just creates it (misleading!). Then you can use:

    profile["FirstName"] = model.FirstName;
    profile["LastName"] = model.LastName;
    

    Don’t forget to call profile.Save(); after setting the values

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC3 site that needs to handle user posts. I am trying
I have a MVC3 site in .Net 4.0 running on IIS6 with extensionless manner
I have .net mvc3 web site. And i must to implement top menu. Each
I have published an ASP.NET MVC3 site. It runs great. However, looking back at
Assume we have an ASP.NET MVC3 Web site that makes use of Entity Framework
I have a .net mvc3 site and want to use the ActiveMq amq.js ajax
I'm writing an MVC3 site, and I'm using JQuery unobtrusive validation to validate my
I have a MVC3 site which needs users to be able to login in
I have a MVC3 site in C#, I have a particular view being fed
here's my setup: I have an MVC3 site hosted with a www subdomain (e.g.,

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.