, Index(), :
using System;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.Mvc; namespacePartyInvites.Controllers{publicclassHomeController: Controller {publicViewResultIndex(){returnView(); } }}ViewResult , MVC, . ViewResult View() . MVC , .
, , MVC Framework , :
. , MVC , , . MVC: . Index(), - Home, , , MVC Views .
VisualStudio. Index() , HomeController.cs, AddView ( ), :
VisualStudio AddView ( ), , . ViewName ( ) Index ( , - ), Template () Empty (withoutmodel) ( ( )) Createas a partialview ( ) Use a layoutpage ( ) :
, - . Add (), .
VisualStudio Index.cshtml Views/Home. , , . MVC Framework: Views, , .
.cshtml C#, Razor. MVC ASPX, .aspx.
AddView VisualStudio , :
|
|
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="/>
<title>Index</title>
</head>
<body>
<div>
</div>
</body>
</html>
Visual Studio Index.cshtml. , HTML-. , :
@{
Layout = null;
}
, Razor. HTML-, . Razor Razor , : HTML-, . Razor, . Index.cshtml , :
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="/>
<title>Index</title>
</head>
<body>
<div>
Helloworld ( )
</div>
</body>
</html>
. Debug StartDebugging, . , :
Index() . , MVC . , Index() ViewResult, MVC Framework HTML-.
MVC, , . , , : ~/Views/Home/Index.cshtml.
ViewResult . , RedirectResult, URL. HttpUnauthorizedResult, . , ActionResult. .