I am new to MVC so I am still learning my way. I am submitting a form,and I need to grab the data of one of the textboxes and pass it to the URL. My Routeconfig is default so I know I have the route correctly, now this is my controller:
AcceptVerbs(HttpVerbs.Post)]
public ActionResult Verify(string verificationString)
{
return View();
}
And my view has this:
@using(Html.BeginForm("Verify", "Status", FormMethod.Post)) {
@Html.AntiForgeryToken()
@Html.TextBoxFor(m => m.verificationCode, new { @name="verificationID", @class = "form-control", @maxlength = "18", @required="required" })
}
I don't know how to pass this variable in the URL so it shows /Status/Verify/verificationstring(textbox data). How can I do this?
EDIT: RouteConfig
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
EDIT: FullView
@model LSFVerif.Models.StatusModel
<div class='form-group' style="text-align:center">
@using(Html.BeginForm("Verify", "Status", FormMethod.Post)) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
@Html.TextBoxFor(m => m.Email, new { @class = "form-control", @type="email", @placeholder = "Email", @maxlength = "100", @required="required" })
@Html.TextBoxFor(m => m.VerificationCode, new { @name="VerificationCode", @class = "form-control", @placeholder = "Codigo", @maxlength = "18", @required="required" })
<button class='btn-lg btn-primary' type='submit'>Verify</button>
}