i making login system with razor page
I want to get data from cshtml inputbox
request.form is null
i learn razor page this link this
I want to know why request.form is null
this is cshtml
@page "/Login"
@model WebApplication1.Pages.Login.LoginPageModel
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}
<form class="form-horizontal" method="post">
<div class="form-group">
<label for="Userid" class="col-sm-2 control-label">Userid</label>
<div class="col-md-4">
<input type="text" class="form-control" name="Userid">
</div>
</div>
<div class="form-group">
<label for="Userpassword" class="col-sm-2 control-label">Userpassword</label>
<div class="col-md-4">
<input type="password" class="form-control" name="Userpassword">
</div>
</div>
</form>
<form method="post">
<input asp-page-handler="Login" class="btn" type="submit" value="login" />
</form>
this is cs
public IActionResult OnPostLogin()
{
string _id = Request.Form["Userid"].ToString();
string _password = Request.Form["Userpassword"].ToString();
if (_id.Length == 0)
return Page();
}
doesnot pass _id.Length == 0
Aucun commentaire:
Enregistrer un commentaire