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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:13:16+00:00 2026-06-18T09:13:16+00:00

I am learning a newly created default simple MVC4 web project. In the index

  • 0

I am learning a newly created default simple MVC4 web project.

In the index page, I have a link for the user to log on the site with his account. After that he will be redirected to a form to enter new name, new password.

I have this form ready for validation using [Required]. But as sooon as the redirected page is completely loaded, these controls (username and password) were done validated (Field needs be filled in) too.

Here is the code of POST after the user log in with his account

if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
{
    return RedirectToCreateUser(returnUrl);
}

// If we got this far, something failed, redisplay form
ModelState.AddModelError("", "The user name or password provided is incorrect.");
return View(model);

and here is the method RedirectToCreateUser

private ActionResult RedirectToCreateUser(string url)
{
    if (Url.IsLocalUrl(url))
    {
        return Redirect(url);
    }
    else
    {
        return RedirectToAction("CreateNewUser", "Account");
    }
}

finally the CreateNewUser method which is for http GET

public ActionResult CreateNewUser(CreateNewUserModel model)
{         
    return View(model);
}

and another one for http POST which I think hasn’t been accessed yet though.

[HttpPost]
public ActionResult CreateNewUser(CreateNewUserModel model, string url)
{
    if (ModelState.IsValid)
    {
        // Attempt to register the user
        try
        {
            WebSecurity.CreateUserAndAccount(model.UserName, model.Password, null, true);
            WebSecurity.Login(model.UserName, model.Password);
            return RedirectToAction("CreateUserSuccess", "Account");
        }
        catch (MembershipCreateUserException e)
        {
            ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
        }
    }
    else
    {
    }
    return View(model);
}
  • 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-18T09:13:17+00:00Added an answer on June 18, 2026 at 9:13 am

    your problem is here

    finally the CreateNewUser method which is for http GET

    public ActionResult CreateNewUser(CreateNewUserModel model)
    {         
        return View(model);
    }
    

    You cannot pass an object as a parameter on a get request. Probably that signature should be

    public ActionResult CreateNewUser()
    {    
        var model = new CreateNewUserModel();     
        return View(model);
    }
    

    or something similar

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

Sidebar

Related Questions

Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
Learning java newly. Can anybody clear my doubt in following? My demo application has
Learning progaming with symfony is a evolutional process (for me). So, I have to
I am trying to make a very simple window manager for learning purposes. I
I building a simple, 7 page, database driven, website, and I would like to
learning about loops (still a beginner) in VB.net. I have got the below code
Learning php! I have a sql database which contains a table called 'images' which
Learning .NET: I have a form with a split container, I want to load
Learning ruby on rails, playing around with routes and path methods. I have built
As I'm learning the ins and outs of ASP.NET user management, I've learned that

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.