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

  • Home
  • SEARCH
  • 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 9125593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:50:25+00:00 2026-06-17T06:50:25+00:00

I am having issues retaining the passwordToken between my GET Controller and my View.

  • 0

I am having issues retaining the passwordToken between my GET Controller and my View. I see that the token is passed and added to the model correctly within the GET Controller but as soon as the HTML.BeginForm starts in the View the model has a new instance and the previous model with the passwordToken is lost. I need the passwordToken to be retained in order to use WebSecurity.ResetPassword. Any suggestions on how this could be done?

My GET Controller:

    [AllowAnonymous]
    public ActionResult PasswordReset(string passwordToken)
    {
        // Token Validation
        var usrID = WebSecurity.GetUserIdFromPasswordResetToken(passwordToken);
        var usr = _dbManager.GetUserInformation(usrID);

        if (usr == null)
        {
            //The link you are using is not valid anymore
            return RedirectToAction("Error", "Account");
        }
        else
        {
            var model = new PasswordReset();
            model.PasswordResetToken = passwordToken;
            return View(model);
        }
    }

My View:

@model Project.Models.PasswordReset
@{
ViewBag.Title = "Password Reset";
}

<h2>Password Reset</h2>

<div class="form passwordreset-form">


@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary()

    <div class="input-form">

        <div class="inputbox-label">
            @Html.LabelFor(m => m.Password)
        </div>
        <div class="inputbox">
            @Html.PasswordFor(m => m.Password)
        </div>

        <div class="inputbox-label">
            @Html.LabelFor(m => m.ConfirmPassword)
        </div>
        <div class="inputbox">
            @Html.PasswordFor(m => m.ConfirmPassword)
        </div>

    </div>
    <div style="float:right;">
        <input type="submit" value="Change Password" />
    </div>

}

</div>

My POST Controller:

    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public ActionResult PasswordReset(PasswordReset model)
    {
        //Attemp to change password
        var passwordChangeConfirmation = WebSecurity.ResetPassword(model.PasswordResetToken, model.Password); 

            //Password has been changed
        if(passwordChangeConfirmation == true)
        {
            return RedirectToAction("Index", "Home");
        }
            //Password change has failed
        else
        {
            return RedirectToAction("Error", "Account");
        }
    }
  • 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-17T06:50:26+00:00Added an answer on June 17, 2026 at 6:50 am

    I ended up adjusting the POST class to make it work.

        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult PasswordReset(PasswordReset model, string passwordToken)
        {
            //Attemp to change password
            model.PasswordResetToken = passwordToken;
            var passwordChangeConfirmation = WebSecurity.ResetPassword(model.PasswordResetToken, model.Password);
    
            //Password has been changed
            if (passwordChangeConfirmation == true)
            {
                return RedirectToAction("Index", "Home");
            }
            //Password change has failed
            else
            {
                return RedirectToAction("Error", "Account");
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My business partner and I are having issues selecting from a MySQL view that
I'm having issues trying to parse a datetime field that I am returning in
Okay, so I'm having issues getting the value of a DropDownList that's inside of
I am having some issues with CakePHP's find() method and conditions in 'deeper' model
Im having issues with my code, its returning an error that says... 2011-12-24 22:52:36.280
I hope I'm not repeating an existing question but I'm having some issues retaining
I'm having some issues returning unique results from a table that has some repeating
I'm using Ember 0.9.8.1 and having an issue with nested views not retaining the
Having issues with Twitter Bootstrap responsive navigation. The best way to explain this is
Having issues referencing $(this) from within a the nested ajax 'success' function... I know

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.