12 |
13 |
Getting started
14 |
15 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
16 | enables a clean separation of concerns and gives you full control over markup
17 | for enjoyable, agile development.
18 |
19 |
Learn more »
20 |
21 |
22 |
Get more libraries
23 |
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
24 |
Learn more »
25 |
26 |
27 |
Web Hosting
28 |
You can easily find a web hosting company that offers the right mix of features and price for your applications.
29 |
Learn more »
30 |
31 |
--------------------------------------------------------------------------------
/source/Sample/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 | @Html.FlushHead()
2 |
3 |
25 | @RenderBody()
26 |
27 |
30 |
31 |
32 | @Scripts.Render("~/bundles/jquery")
33 | @Scripts.Render("~/bundles/bootstrap")
34 | @RenderSection("scripts", required: false)
35 |
36 |
37 |
--------------------------------------------------------------------------------
/source/Sample/Views/Home/Index_Alternative.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Home Page Alternative";
3 | }
4 |
5 |
12 |
13 |
Getting started alternative
14 |
15 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
16 | enables a clean separation of concerns and gives you full control over markup
17 | for enjoyable, agile development.
18 |
19 |
Learn more »
20 |
21 |
22 |
Get more libraries
23 |
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
24 |
Learn more »
25 |
26 |
27 |
Web Hosting
28 |
You can easily find a web hosting company that offers the right mix of features and price for your applications.
29 |
Learn more »
30 |
31 |
--------------------------------------------------------------------------------
/source/CourtesyFlush/HtmlHelperExtension.cs:
--------------------------------------------------------------------------------
1 | using System.Web.Mvc;
2 | using System.Web.Mvc.Html;
3 | using CourtesyFlush;
4 |
5 | namespace System.Web.WebPages
6 | {
7 | public static class HtmlHelperExtension
8 | {
9 | public static MvcHtmlString FlushHead(this HtmlHelper html)
10 | {
11 | return FlushHead(html, null);
12 | }
13 |
14 | public static MvcHtmlString FlushHead(this HtmlHelper html, string headername)
15 | {
16 | if (String.IsNullOrWhiteSpace(headername))
17 | headername = "_Head";
18 |
19 | if (!html.ViewData.ContainsKey("HeadFlushed"))
20 | return html.Partial(headername);
21 |
22 | return new MvcHtmlString(string.Empty);
23 | }
24 |
25 | #if NET45
26 | public static MvcHtmlString FlushedAntiForgeryToken(this HtmlHelper html)
27 | {
28 | var token = html.ViewContext.HttpContext.Items[ControllerBaseExtension.FlushedAntiForgeryTokenKey] as string;
29 |
30 | if (string.IsNullOrEmpty(token))
31 | {
32 | // Fall back to the standard AntiForgeryToken if no FlushedAntiForgeryToken exists.
33 | return html.AntiForgeryToken();
34 | }
35 |
36 | var tag = new TagBuilder("input");
37 | tag.Attributes["type"] = "hidden";
38 | tag.Attributes["name"] = "__RequestVerificationToken";
39 | tag.Attributes["value"] = token;
40 |
41 | return new MvcHtmlString(tag.ToString(TagRenderMode.SelfClosing));
42 | }
43 | #endif
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/source/CourtesyFlush/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("CourtesyFlush")]
8 | [assembly: AssemblyConfiguration("")]
9 | [assembly: AssemblyProduct("CourtesyFlush")]
10 | [assembly: AssemblyCopyright("Copyright © 2014")]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 |
14 | // Setting ComVisible to false makes the types in this assembly not visible
15 | // to COM components. If you need to access a type in this assembly from
16 | // COM, set the ComVisible attribute to true on that type.
17 | [assembly: ComVisible(false)]
18 |
19 | // The following GUID is for the ID of the typelib if this project is exposed to COM
20 | [assembly: Guid("6506d8fd-33df-4213-99f0-417a98de6885")]
21 |
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Build and Revision Numbers
30 | // by using the '*' as shown below:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion("1.1.0.0")]
33 | [assembly: AssemblyFileVersion("1.1.0.0")]
34 | [assembly: AssemblyInformationalVersion("1.1.0")]
35 | [assembly: AssemblyCompany("Nik Molnar")]
36 | [assembly: AssemblyDescription("A library to simplify flushing early in ASP.NET MVC")]
37 |
--------------------------------------------------------------------------------
/source/Sample/Views/Shared/_Layout_Alternative.cshtml:
--------------------------------------------------------------------------------
1 | @Html.FlushHead()
2 |
3 |
25 |
This is an alternative layout page.
26 | @RenderBody()
27 |
28 |
31 |
32 |
33 | @Scripts.Render("~/bundles/jquery")
34 | @Scripts.Render("~/bundles/bootstrap")
35 | @RenderSection("scripts", required: false)
36 |
37 |
38 |
--------------------------------------------------------------------------------
/source/Sample/Views/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |