The
Views folder stores the
files (HTML files) related to the display of the application (the user
interfaces). These files may have the extensions html, asp, aspx, cshtml, and
vbhtml, depending on the language content.The Views folder contains one folder
for each controller. Visual Web Developer has created an Account folder, a
Home folder, and a Shared folder (inside the Views folder).The Account folder
contains pages for registering and logging in to user accounts.The Home folder
is used for storing application pages like the home page and the about page.The
Shared folder is used to store views shared between controllers (master pages
and layout pages).
ASP.NET File Types
The following HTML file types can be found in the Views Folder:
|
File Type
|
Extention
|
|
Plain HTML
|
.htm or .html
|
|
Classic ASP
|
.asp
|
|
Classic ASP.NET
|
.aspx
|
|
ASP.NET Razor C#
|
.cshtml
|
|
ASP.NET Razor VB
|
.vbhtml
|
The Index File
The file Index.cshtml represents the Home page of the application. It is the
application's default file (index file).
Put the following content in the file:
@{
ViewBag.Title = "Home Page";
}
@section featured {
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
<h2>@ViewBag.Message</h2>
</hgroup>
<p>
To learn more about ASP.NET MVC visit
<a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
The page features <mark>videos, tutorials, and samples</mark> to help you get the most from ASP.NET MVC.
If you have any questions about ASP.NET MVC visit
<a href="http://forums.asp.net/1146.aspx/1?MVC" title="ASP.NET MVC Forum">our forums</a>.
</p>
</div>
</section>
}
<h3>We suggest the following:</h3>
<ol class="round">
<li class="one">
<h5>Getting Started</h5>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and that gives you full control over markup
for enjoyable, agile development. ASP.NET MVC includes many features that enable
fast, TDD-friendly development for creating sophisticated applications that use
the latest web standards.
<a href="http://go.microsoft.com/fwlink/?LinkId=245151">Learn more…</a>
</li>
<li class="two">
<h5>Add NuGet packages and jump-start your coding</h5>
NuGet makes it easy to install and update free libraries and tools.
<a href="http://go.microsoft.com/fwlink/?LinkId=245153">Learn more…</a>
</li>
<li class="three">
<h5>Find Web Hosting</h5>
You can easily find a web hosting company that offers the right mix of features
and price for your applications.
<a href="http://go.microsoft.com/fwlink/?LinkId=245157">Learn more…</a>
</li>
</ol>
The About File
The file About.cshtml represent the About page of the application.
Put the following content in the file:
@{
ViewBag.Title = "About";
}
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
<h2>@ViewBag.Message</h2>
</hgroup>
<article>
<p>
Use this area to provide additional information.
</p>
<p>
Use this area to provide additional information.
</p>
<p>
Use this area to provide additional information.
</p>
</article>
<aside>
<h3>Aside Title</h3>
<p>
Use this area to provide additional information.
</p>
<ul>
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</aside>
Run the Application
Select Debug, Start Debugging (or F5) from the Visual Web Developer menu.
Your application will look like this: