J'ai une page de connexion que les utilisateurs peuvent utiliser pour se connecter, j'ai défini sa méthode dans le contrôleur comme HttpPost, quand j'essaie d'y accéder depuis le navigateur, il ne montre aucun fichier trouvé , si je supprime l'attribut HttpPost il frappe le contrôleur et le retour view.Eventhough passer les valeurs sous la forme de contrôleur si je ne mentionnais son type comme HttpPost .Voici mon code de Connexion/SignIn.cshtml:Impossible d'appeler une méthode si j'ai mentionné son attribut comme HttpPost
@model BOL.Player_Access
@using (Html.BeginForm("SignIn","Login",FormMethod.Post)){
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Sign In</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.PlayerEmail, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.PlayerEmail, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.PlayerEmail, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Password, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Password, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="SignIn" class="btn btn-default" />
</div>
</div>
</div>
Et mon code LoginController est ici
[AllowAnonymous] //This filter removes authorize filter for this controller alone and allow anonyomous request
public class LoginController : Controller
{
// GET: Login
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult SignIn(Player_Access plyr_obj)
{
return View();
}
}
Affichez votre code complet. Accolades de fin manquant. –