-1

i want to send current url query string to Action but the value is empty inside second Action

    public ActionResult Edit(string userId) // start action
    {
        try
        {
            var userID = userId.Unprotect<int>("userId");
            return View(model: person);
        }
        catch
        {
            return HttpNotFound();
        }
    }

URL

http://localhost:25388/Home/Edit?userId=MsIJTy8Ea6ixr1E3xafN2SoUkHrXon3jcUMnlHPMaTZPW7XYma5Wqtkr9JGn4Ue8PImfNw%3D%3D

and the destination action method is:

    [HttpPost]
    public ActionResult EditSubmit(string userID, Person person) // second action
    {
        var test = Request.QueryString;
        return RedirectToAction("Index", "Home");
    }

is there any way to receive first action/url query strings inside second action? (I mean receive the value of userId )

userId=MsIJTy8Ea6ixr1E3xafN2SoUkHrXon3jcUMnlHPMaTZPW7XYma5Wqtkr9JGn4Ue8PImfNw%3D%3D
VanasisB
  • 39
  • 2
  • 6

1 Answers1

-1

i reached my goal with sending current URL QueryString part with Form submit Part here is the code:

@using (Html.BeginForm("EditSubmit", "Home", new {userId = Request.QueryString["userId"]}, FormMethod.Post))
{
  <input type="submit" value="Save" class="btn btn-success btn-sm" />
}

here is the main part

Request.QueryString["userId"] (inside view)
VanasisB
  • 39
  • 2
  • 6