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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:07:55+00:00 2026-05-25T17:07:55+00:00

i have a project that use MVC3. in my project, i have a page

  • 0

i have a project that use MVC3. in my project, i have a page that user can edit their account (UserComment, UserEmail, IsLocked, IsApproved). i already make the View for Edit Account. i have some trouble to make the Edit Controller.
here’s my code:

    [HttpPost]
    public ActionResult Edit(string id, FormCollection collection)
    {
        id = id.Replace("+", " ");
        var user = Membership.GetUser();
        Guid UserGUID = new Guid(user.ProviderUserKey.ToString());
        var SysUser = db.System_User.Single(u => u.User_UserId == UserGUID);

        //this is for updating User Office in my System_user table
        SysUser.User_Office = collection["SysUsers[0].UserOffice"];

        //this is for updating User Account in aspnet_membership table
        user.UserName = collection["SysUsers[0].UserName"];
        Membership.UpdateUser(user);

        user.Comment = collection["SysUsers[0].UserComment"];
        Membership.UpdateUser(user);

        user.Email = collection["SysUsers[0].UserEmail"];
        Membership.UpdateUser(user);

        return View();
    }

when i run my controller, i get some error like :

  1. user.UserName is read only, i cant update this one.
  2. i get user.Comment value, but its not update.
  3. i get error in my Edit View, it says “Object reference not set to an instance of an object.”
    @using (Html.BeginForm(“edit/” + @Model.SysUsers[0].UserID, “cpanel/sysuser”, FormMethod.Post))

can anyone help me ?

thanks,

  • 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-25T17:07:55+00:00Added an answer on May 25, 2026 at 5:07 pm

    You cannot update the UserName of a user using ASP.NET Membership provider. You need to write some custom data access logic if you wish to update a username.

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

Sidebar

Related Questions

I know that I can use popToRootViewController if I have navigationController in my project
Edit: showed my exact web.config code. I have a MVC3 project that works fine
We have a Library Project that we use for all our central reused code
Good day, I have a library project that i use to create a paid
I have inherited a web site project that makes use of a number of
My use case is this... I have a project that has two production branches.
I have a maven project that contains a certain api I need to use
I have a working project that Im amending, it crashes after trying to use
I want to add more functionality to a project I have that makes use
I have a PhoneGap/Cordova project that means I must use a combination of JQuery

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.