OkController page located in the Controller folder, the following code================
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. The Web;
Using System. Web. Mvc;
The namespace WebApplication1. Models
{
Public class okController: Controller
{
//
//GET/ok/:
Public ActionResult Index ()
{
Return the View ();
}
}
Public class person
{
//[Required] (ErrorMessage="please enter the name")
Public string name {get; set; }
Public string email {get; set; }
}
}
LoginController page is also under the Controller folder, the following code================
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. The Web;
Using System. Web. Mvc;
The namespace WebApplication1. Controllers
{
Public class LoginController: Controller
{
//
//GET/Login/:
Public ActionResult Index ()
{
Response. Write (" not right!" );
Return the View ();
}
Public ActionResult Login ()
{
Response. Write (" not right!" );
Return the View ();
}
}
}
Complete index.cshtml in Views/Home, the code is as follows:==================
@ model WebApplication1. Models. The person
@ {
Layout=null;
}
<body>
@ the using (Html BeginForm ())
{
Your name: @ Html. TextBoxFor (model=& gt; Model. The name) & lt;/p>
Email address: @ Html. TextBoxFor (model=& gt; Model. Email) & lt;/p>
}