title: How to show a success message in ASP.Net
body: <p>I am a beginner and learning ASP.Net MVC web development. I am stuck at one place. </p>
  
  <p>I have a reset password window. If user successfully resets the password I want him to redirect to the same page but I want a "Password Reset Successful" message to be on top. It can be an alert or something. Just user should know that password has been reset. But I don't know how to achieve this. Below is what I have till now.</p>
  
  <pre><code> [HttpPost]
      [ValidateAntiForgeryToken]
      public ViewResult WidgetResetPassword(ResetPasswordMV data)
      {
          bool isValid = false;
  
          isValid = ModelState.IsValid;
  
          // verify the 2 password match
          if (isValid &amp;&amp; !data.NewPassword.Equals(data.ConfirmNewPassword))
          {
              isValid = false;
              ModelState.AddModelError("ConfirmNewPassword", "Passwords doesn't match.");
          }
  
          if (isValid)
          {
              //setting the correct tenant id
              if (Session[Constants.SESSION_USER_KEY] != null)
              {
                  UserMV authenticatedUsers = (UserMV)Session[Constants.SESSION_USER_KEY];
  
                  data.UserId = authenticatedUsers.Id;
              }
  
              ResetPasswordHelper.Save(data);
          }
          return View(data);
      }
  </code></pre>
  
  <p><strong>My .cshtml file:</strong></p>
  
  <pre><code>@model ResetPasswordMV
  @using SIM_Obj.ModelViews;
  
  @{
      ViewBag.Title = "Reset Password";
  }
  
  @using (Html.BeginForm())
  {
          @Html.AntiForgeryToken()
  
  @*    &lt;div id="ResetPasswordWidget" class="form-horizontal"&gt;*@
          &lt;div id="ResetPasswordWidget" class="form-horizontal-width-inherit"&gt;
              &lt;h3&gt;Reset Password&lt;/h3&gt;
              &lt;hr/&gt;
  
              @Html.ValidationSummary(true, "", new {@class = "text-danger"})
  
              @Html.HiddenFor(model =&gt; model.UserId)
  
              &lt;div class="form-group"&gt;
                  @Html.LabelFor(model =&gt; model.OldPassword, htmlAttributes: new {@class = "control-label col-md-2"})
                  &lt;div class="col-md-10"&gt;
                      @Html.EditorFor(model =&gt; model.OldPassword, new {htmlAttributes = new {@class = "form-control"}})
                      @Html.ValidationMessageFor(model =&gt; model.OldPassword, "", new {@class = "text-danger"})
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  @Html.LabelFor(model =&gt; model.NewPassword, htmlAttributes: new {@class = "control-label col-md-2"})
                  &lt;div class="col-md-10"&gt;
                      @Html.EditorFor(model =&gt; model.NewPassword, new {htmlAttributes = new {@class = "form-control"}})
                      @Html.ValidationMessageFor(model =&gt; model.NewPassword, "", new {@class = "text-danger"})
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  @Html.LabelFor(model =&gt; model.ConfirmNewPassword, htmlAttributes: new {@class = "control-label col-md-2"})
                  &lt;div class="col-md-10"&gt;
                      @Html.EditorFor(model =&gt; model.ConfirmNewPassword, new {htmlAttributes = new {@class = "form-control"}})
                      @Html.ValidationMessageFor(model =&gt; model.ConfirmNewPassword, "", new {@class = "text-danger"})
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  &lt;div class="col-md-offset-2 col-md-10"&gt;
                      &lt;input type="submit" value="Reset Password" class="btn btn-default"/&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      }
  </code></pre>
  
  <p>I want to be able to add something like:</p>
  
  <pre><code>&lt;p class ="alert alert-success"&gt; &lt;strong&gt;Success! &lt;/strong&gt;Your Password has been successfully changed.&lt;/p&gt;
  </code></pre>
  
  <p>Question 1: How to get this <p> to be displayed when password is reset.</p>
  
  <p>Question 2: Currently I am doing <code>return view(data)</code> in the controller. Is it necessary.</p>
  
  <p>Question 3: Can I use something like partialview. I am beginner. Please guide me.</p>