Problème sur la page login
Bonjour,
J'ai fait un petit exercice à l'aide de ASP.NET, il y a une page Index.aspx qui demande à entrer le nom utilisateur.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Log in</title>
</head>
<body>
<div>
<form action="Display" method="post">
Login :<input type="text" name="login" /><br />
<input type="submit" value="Valider" /><br />
</form>
</div>
</body>
</html> |
il y a un warning au-dessous form action="Display", "file 'Display' was not found'"
Normalement, "form action="Display" doit appeler la méthode suivante, mais il n'arrive pas
Code:
1 2 3 4 5 6 7 8 9
| [HttpPost]
public ActionResult Display()
{
User obj = new User();
obj.Login=Request.Form["login"];
SqlConnection cn = new SqlConnection("Data Source=vdw-nexfi-004;Persist Security Info=True;User ID=gao_s;Password=gao_s");
return View(obj);
} |
Après exécution, il s'affiche
Code:
1 2 3 4 5 6 7 8 9 10 11
| Server Error in '/' Application.
--------------------------------------------------------------------------------
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Display
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1022 |
Je ne comprends pas cette erreur......