diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/AnchorTagHelper.md b/aspnetcore/mvc/views/tag-helpers/built-in/AnchorTagHelper.md new file mode 100644 index 000000000000..8280591ac235 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/AnchorTagHelper.md @@ -0,0 +1,191 @@ +--- +title: Anchor Tag Helper | Microsoft Docs +author: Peter Kellner +description: Shows how to work with Anchor Tag Helper +keywords: ASP.NET Core,tag helper +ms.author: riande +manager: wpickett +ms.date: 02/14/2017 +ms.topic: article +ms.assetid: c045d485-d1dc-4cea-a675-46be83b7a011 +ms.technology: aspnet +ms.prod: aspnet-core +uid: mvc/views/tag-helpers/builtin-th/AnchorTagHelper +--- + +# Anchor Tag Helper + +By [Peter Kellner](http://peterkellner.net) + + +The Anchor Tag Helper enhances the html anchor (``) tag. A new set of attributes are defined that work with the anchor tag. The link generated (on the `href` tag) is based on a combination of these new attributes that work together to form the final URL. That URL can include an optional protocol such as https. + +The speaker controller used in attribute definitions below is shown here. + +
+**SpeakerController.cs** + +[!code-csharp[SpeakerController](sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/SpeakerController.cs)] + + +## Anchor Tag Helper Attributes + +- - - + +### asp-controller + +`asp-controller` is used to associate which controller will be used to generate the final URL. The only valid choices are controllers that exist in the current project. To get to a list of all speakers specifying `asp-controller="Speaker"` is required. If only the `asp-controller` and no `asp-action` is specified, the default asp-action will be the name of the the controller method calling this view page. + +- - - + +### asp-action + +`asp-action` is the name of the method in the controller that will be included in the final URL. That is, in the example, if the route to the Speaker Detail page is wanted, then the attribute should be set to `asp-action=Detail`. You should always set `asp-controller` when specifying `asp-action`. If no `asp-action` is specified then the default `asp-controller` will be the current executing controller. + +- - - + +### asp-route-{value} + +`asp-route-` is a wild card route prefix. Any value you put after the trailing dash will be interpreted as the parameter to pass into the route. For example, if a tag is created as follows: + +`Speaker 11` + +the `href` generated will be + +`Speaker 11` + +This is because a route was found that matched a single parameter "id" in the ```SpeakerController``` method ```Detail```. If there was no parameter match, say for example you created the tag helper + +`Ronald` + +you would get generated the html + +`Ronald` + +This is because there was no route found that matched a controller that had a method named `Detail` with one string parameter titled `name`. + +- - - + +### asp-route + +`asp-route` provides a way to create a URL that links directly to a named route. Using routing attributes, a route can be named as shown in the `SpeakerController` and used in its `Evaluations` method. + +`Name = "speakerevals"` tells the Anchor Tag Helper to generate a route directly to that controller method using the URL `/Speaker/Evaluations`. If `asp-controller` or `asp-action` is specified in addition to `asp-route`, the route generated may not be what you expect. `asp-route` should not be used with either of the attributes `asp-controller` or `asp-action` to avoid a route conflict. + +- - - + +### asp-all-route-data + +`asp-all-route-data` allows creating on a .NET context (that is, the running C# associated with your Razor view) a dictionary of key value pairs where the key is the parameter name and the value is the value associated with that key. + +As the example below shows, an inline dictionary is created and the data is passed to the razor view. The data could also be passed in with your model to keep the Razor view simpler. + +``` +@{ + var dict = + new Dictionary + { + {"speakerId", "11"}, + {"currentYear", "true"} + }; +} +SpeakerEvals +``` + +The code that this generates looks as follows: + +``` +http://localhost/Speaker/EvaluationsCurrent?speakerId=11¤tYear=true +``` + +When the link is clicked, this will call the controller method `EvaluationsCurrent` because that controller has two string parameters that match what has been created from the `asp-all-route-data` dictionary. + +- - - + +### asp-fragment + +`asp-fragment` defines a URL fragment to append to the URL. The Anchor Tag Helper will add the hash character (#) automatically. If you create a tag: + +``` +About Speaker Evals +``` + +The generated URL will be + + +``` +http://localhost/Speaker/Evaluations#SpeakerEvaluations +``` + +Hash tags are useful when doing client side applications. They can be used for easy marking and searching in JavaScript for example. + +- - - + +### asp-area + +`asp-area` sets the area name that ASP.NET Core uses to set the appropriate route. Below are examples of how the area attribute causes a remapping of routes. Setting `asp-area` to Blogs prefixes the directory Areas/Blogs to the routes of the associated controllers and views for this anchor tag.. + +* Project name + + * *wwwroot* + + * *Areas* + + * *Blogs* + + * *Controllers* + + * *HomeController.cs* + + * *Views* + + * *Home* + + * *Index.cshtml* + + * *AboutBlog.cshtml* + + * *Controllers* + + + +Specifying an area tag that is valid, such as ```area="Blogs"``` when referencing the ```AboutBlog.cshtml``` file will look like the following using the Anchor Tag Helper. + +``` +Blogs About +``` + +The generated HTML will include the areas segment and will be as follows: + +``` +Blogs About +``` + +> [!TIP] +> For MVC areas to work in a web application, the route template must include a reference to the area if it exists. That template, which is the second parameter of the `routes.MapRoute` method call, will appear as: template: '"{area:exists}/{controller=Home}/{action=Index}"' + +- - - + +### asp-protocol + +The `asp-protocol` is for specifying a particular protocol (such as `https`) in your URL. An example Anchor Tag Helper that includes the protocol will look as follows. + +```About``` + +and will generate HTML as follows. + +```About``` + +The domain in the example is localhost, but the Anchor Tag Helper uses the website's public domain when generating the URL. + +- - - + +## Additional Resources + +* [Areas](xref:mvc/controllers/areas) + + + + diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/CacheTagHelper.md b/aspnetcore/mvc/views/tag-helpers/built-in/CacheTagHelper.md new file mode 100644 index 000000000000..60d57467d39a --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/CacheTagHelper.md @@ -0,0 +1,295 @@ +--- +title: Anchor Tag Helper | Microsoft Docs +author: Peter Kellner +description: Shows how to work with Cache Tag Helper +keywords: ASP.NET Core,tag helper +ms.author: riande +manager: wpickett +ms.date: 02/14/2017 +ms.topic: article +ms.assetid: c045d485-d1dc-4cea-a675-46be83b7a012 +ms.technology: aspnet +ms.prod: aspnet-core +uid: mvc/views/tag-helpers/builtin-th/CacheTagHelper +--- + +# Cache Tag Helper + +By [Peter Kellner](http://peterkellner.net) + + +The Cache Tag Helper provides the ability to dramatically improve the performance of your ASP.NET Core app by caching its content to the internal ASP.NET Core cache provider. + +A simple example that shows the Cache Tag Helper in action sets the current time in its content area. The Razor View Engine sets the default `expires-after` to twenty minutes, which is the default if you specify no additional attributes. + +The following Razor markup caches the date/time: + +```html +@DateTime.Now +``` + +The first request to the page that contains `CacheTagHelper` will display the current date/time. Additional requests will show the cached value until the cache expires (default 20 minutes) or is evicted by memory pressure. + +You can set the cache duration with the following attributes: + +## Cache Tag Helper Attributes + +- - - + +### enabled + + +| Attribute Type | Valid Values | +|---------------- |---------------- | +| boolean | "true" (default) | +| | "false" | + + +Determines whether the content enclosed by the Cache Tag Helper is cached. The default is `true`. If set to `false`, regardless of what other attributes are specified, this Cache Tag Helper will have no caching effect on the rendered output. + +Usage Example: + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +- - - + +### expires-on + +| Attribute Type | Example Value | +|---------------- |---------------- | +| DateTimeOffset | "@new DateTime(2025,1,29,17,02,0)" | + + +Sets an absolute expiration date. The example below will cache the contents of the Cache Tag Helper until 5:02 PM on January 29, 2025. + +Usage Example: + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +- - - + +### expires-after + +| Attribute Type | Example Value | +|---------------- |---------------- | +| TimeSpan | "@TimeSpan.FromSeconds(10)" | + + +Sets the length of time from the first request time to cache the contents. + +Usage Example: + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +- - - + +### expires-sliding + +| Attribute Type | Example Value | +|---------------- |---------------- | +| TimeSpan | "@TimeSpan.FromSeconds(5)" | + + +Sets the time that a cache entry should be evicted if it has not been accessed. + +Usage Example: + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +- - - + +### vary-by-header + +| Attribute Type | Example Values | +|---------------- |---------------- | +| String | "User-Agent" | +| | "User-Agent,content-encoding" | + +Accepts a single header value or a comma-separated list of header values that trigger a cache refresh when they change. The example below monitors the header value `User-Agent`, which will cache the content for every different `User-Agent` presented to the web server. + +Usage Example: + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +- - - + +### vary-by-query + +| Attribute Type | Example Values | +|---------------- |---------------- | +| String | "Make" | +| | "Make,Model" | + +Accepts a single header value or a comma-separated list of header values that trigger a cache refresh when they change. The example below looks at the values of `Make` and `Model`. + +Usage Example: + +``` +html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +- - - + +### vary-by-route + +| Attribute Type | Example Values | +|---------------- |---------------- | +| String | "Make" | +| | "Make,Model" | + +Accepts a single header value or a comma-separated list of header values that trigger a cache refresh when they change. +Usage Example: + +*Startup.cs* + +```csharp +routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{Make?}/{Model?}"); +``` + +*Index.cshtml* + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +- - - + +### vary-by-cookie + +| Attribute Type | Example Values | +|---------------- |---------------- | +| String | ".AspNetCore.Identity.Application" | +| | ".AspNetCore.Identity.Application,HairColor" | + +Accepts a single header value or a comma-separated list of header values that trigger a cache refresh when they change. The example below looks at the cookie associated with asp.net Identity. When a user is authenticated the request cookie to be set which triggers a cache refresh. + +Usage Example: + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +```` + +- - - + +### vary-by-user + +| Attribute Type | Example Values | +|---------------- |---------------- | +| Boolean | "true" | +| | "false" (default) | + +Specifies whether or not the cache should reset when the logged-in user (or Context Principal) changes. The current user is also known as the Request Context Principal and can be viewed in a Razor view by referencing `@User.Identity.Name`. + +The example below looks at the current logged in user. + +Usage Example: + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +> [!NOTE] +> Using the attribute `vary-by-user` maintains the contents in cache through a log-in and log-out cycle. When using `vary-by-cookie` which references the `.AspNetCore.Identity.Application` as shown above, a log-in and log-out action invalidates the cache for the same authenticated user (because a new cookie value is generated). If no user is authenticated, the state is considered a valid. [REVIEW, don't understand this] This means that no logged-in user is one cache state, and the contents will be maintained for that condition as well. + +- - - + +### vary-by + +| Attribute Type | Example Values | +|---------------- |---------------- | +| String | "@Model" | + + +Allows for customization of what data gets cached. When the object referenced by the attribute's string value changes, the content of the Cache Tag Helper is updated. Often a string-concatenation of model values are assigned to this attribute. Effectively, that means an update to any of the concatenated values invalidates the cache. + +The example below assumes the controller method rendering the view sums the integer value of the two route parameters, `myParam1` and `myParam2`, and returns that as the single model property. When this sum changes, the content of the Cache Tag Helper is rendered and cachee again. + +Usage Example: + + +*Controller* + +```csharp +public IActionResult Index(string myParam1,string myParam2,string myParam3) +{ + int num1; + int num2; + int.TryParse(myParam1, out num1); + int.TryParse(myParam2, out num2); + return View(viewName, num1 + num2); +} +``` + +*Index.cshtml* + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +- - - + +### priority + +| Attribute Type | Example Values | +|---------------- |---------------- | +| CacheItemPriority | "High" | +| | "Low" | +| | "NeverRemove" | +| | "Normal" | + +Provides cache eviction guidance to the built-in cache provider. The web server will evict `Low` cache entries first when it's under memory pressure. + +Usage Example: + +```html + + Current Time Inside Cache Tag Helper: @DateTime.Now + +``` + +> [!WARNING] +> The `priority` attribute does not guarantee a specific level of cache retention. `CacheItemPriority` is only a suggestion to the Cache Provider. Setting this attribute to `NeverRemove` does not guarantee that the cache will not be evicted. `CacheItemPriority` sets the priority the cache evicts items under memory pressure. See [Additional Resources](#additional-resources) for more information. + +The Cache Tag Helper is dependent on the the [memory cache service](xref:performance/caching/memory). The Cache Tag Helper adds the service if it has not been added. + +## Additional Resources + +* +* + + + + diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/ImageTagHelper.md b/aspnetcore/mvc/views/tag-helpers/built-in/ImageTagHelper.md new file mode 100644 index 000000000000..c35069ccc49b --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/ImageTagHelper.md @@ -0,0 +1,47 @@ +# ImageTagHelper + +By [Peter Kellner](http://peterkellner.net) + +The Image Tag Helper enhances the `img` (``) tag. It requires a `src` tag as well as the `boolean` attribute `asp-append-version`. + +If the image source (`src`) is a static file on the host web server, a unique cache busting string is appended as a query parameter to the image source. This insures that if the file on the host web server changes, a unique request URL is generated that includes the updated request parameter. The cache busting string is a unique value representing the hash of the static image file. + +If the image source (`src`) isn't a static file (for example a remote URL or the file doesn't exist on the server), the `` tag's `src` attribute is generated with no cache busting query string parameter. + +## Image Tag Helper Attributes + + +### asp-append-version + +When specified along with a `src` attribute, the Image Tag Helper is invoked. + +An example of a valid `img` tag helper is: + +```html + +``` + +If the static file exists in the directory *..wwwroot/images/asplogo.png* the generated html is similar to the following (the hash will be different): + +```html + +``` + +The value assigned to the parameter `v` is the hash value of the file on disk. If the web server is unable to obtain read access to the static file referenced, no `v` parameters is added to the `src` attribute. + +- - - + +### src + +To activate the Image Tag Helper, the src attribute is required on the `` element. + +> [!NOTE] +> The Image Tag Helper uses the `Cache` provider on the local web server to store the calculated `Sha512` of a given file. If the file is requested again the `Sha512` does not need to be recalculated. The Cache is invalidated by a file watcher that is attached to the file when the file's `Sha512` is calculated. + +## Additional Resource + +* + + diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/index.md b/aspnetcore/mvc/views/tag-helpers/built-in/index.md new file mode 100644 index 000000000000..4f6208db71a4 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/index.md @@ -0,0 +1,53 @@ +# ASP.NET Core Built in Razor Tag Helpers + +By [Peter Kellner](http://peterkellner.net) + +Microsoft has included multiple Tag Helpers that can be immediately used in .net Core web projects. These Tag Helpers are complete and production quality and are recommended to be used in projects where appropriate. In this section we will outline all the built in Tag Helpers along with a sample of each tag helper in use. + +> [!NOTE] +> There are other Tag Helpers built in that are not discussed as they are used internally in the Razor view engine. This includes a tag helper for the ~ character which expands to the root path of the web site (among others). + +## Built in ASP.NET Core Tag Helpers + +**[Anchor Tag Helper](AnchorTagHelper.md)** + +**[Cache Tag Helper](CacheTagHelper.md)** + +[comment]: **[DistributedTagHelper](builtin-th/AnchorTagHelper.md)** + +[comment]: **[EnvironmentTagHelper](builtin-th/EnvironmentTagHelper.md)** + +[comment]: **[FormActionTagHelper](builtin-th/FormActionTagHelper.md)** + +[comment]: **[FormTagTagHelper](builtin-th/FormTagHelper.md)** + +**[Image Tag Helper](ImageTagHelper.md)** + +[comment]: **[InputTagHelper](builtin-th/InputTagHelper.md)** + +[comment]: **[LabelTagHelper](builtin-th/LabelTagHelper.md)** + +[comment]: **[LinkTagHelper](builtin-th/LinkTagHelper.md)** + +[comment]: **[OptionTagHelper](builtin-th/OptionTagHelper.md)** + +[comment]: **[ScriptTagHelper](builtin-th/ScriptTagTagHelper.md)** + +[comment]: **[SelectTagHelper](builtin-th/SelectTagTagHelper.md)** + +[comment]: **[TextAreaTagHelper](builtin-th/TextAreaTagHelper.md)** + +[comment]: **[ValidationMessageTagHelper](builtin-th/ValidationMessageTagHelper.md)** + +[comment]: **[ValidationSummaryTagHelper](builtin-th/ValidationSummaryTagHelper.md)** + + + diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/global.json b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/global.json new file mode 100644 index 000000000000..e793049cd534 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/global.json @@ -0,0 +1,6 @@ +{ + "projects": [ "src", "test" ], + "sdk": { + "version": "1.0.0-preview2-003121" + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Areas/Blogs/Controllers/HomeController.cs b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Areas/Blogs/Controllers/HomeController.cs new file mode 100644 index 000000000000..befbd44e601c --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Areas/Blogs/Controllers/HomeController.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Mvc; +namespace TagHelpersBuiltInAspNetCore.Areas.Blogs.Controllers +{ + [Area("Blogs")] + public class HomeController : Controller + { + // GET: // + // need route and attribute on controller: [Area("Blogs")] + //[Area("Blogs")] + public IActionResult Index() + { + return View(); + } + + //[Area("Blogs")] + public IActionResult AboutBlog() + { + return View(); + } + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Areas/Blogs/Views/Home/AboutBlog.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Areas/Blogs/Views/Home/AboutBlog.cshtml new file mode 100644 index 000000000000..95619e2184f0 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Areas/Blogs/Views/Home/AboutBlog.cshtml @@ -0,0 +1,7 @@ +@model dynamic + +@{ + ViewBag.Title = "About Blog Home Index (Area)"; +} + +

About Blog Home Index

diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Areas/Blogs/Views/Home/Index.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Areas/Blogs/Views/Home/Index.cshtml new file mode 100644 index 000000000000..85c9c91237b9 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Areas/Blogs/Views/Home/Index.cshtml @@ -0,0 +1,7 @@ +@model dynamic + +@{ + ViewBag.Title = "Blog (Area) Home Index"; +} + +

Blog Home Index

diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/BuiltInTag.cs b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/BuiltInTag.cs new file mode 100644 index 000000000000..bc13a9bb964a --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/BuiltInTag.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 + +namespace TagHelpersBuiltInAspNetCore.Controllers +{ + public class BuiltInTag : Controller + { + // GET: // + public IActionResult Index() + { + return View(); + } + + public IActionResult AnchorTagHelper() + { + return View(); + } + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/HomeController.cs b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/HomeController.cs new file mode 100644 index 000000000000..b9a2595bc98d --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/HomeController.cs @@ -0,0 +1,55 @@ +using Microsoft.AspNetCore.Mvc; + +namespace TagHelpersBuiltInAspNetCore.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult Index(int number) + { + ViewData["Id"] = number.ToString(); + + return View(); + } + + public IActionResult About() + { + ViewData["Message"] = "Your application description page."; + + return View(); + } + + public IActionResult NonSuckyYouTubeEmbed() + { + return View(); + } + + public IActionResult Sample() + { + return View(); + } + + + + public IActionResult Contact() + { + ViewData["Message"] = "Your contact page."; + + return View(); + } + + public IActionResult Error() + { + return View(); + } + + public IActionResult AboutBlog() + { + return View(); + } + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/SpeakerController.cs b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/SpeakerController.cs new file mode 100644 index 000000000000..d6b6007fc7c1 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Controllers/SpeakerController.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using System.Linq; +using Microsoft.AspNetCore.Mvc; + +namespace TagHelpersBuiltInAspNetCore.Controllers +{ + public class SpeakerController : Controller + { + public List Speakers = + new List + { + new ModelData {SpeakerId = 10}, + new ModelData {SpeakerId = 11}, + new ModelData {SpeakerId = 12} + }; + + [Route("Speaker/{id:int}")] + public IActionResult Detail(int id) + { + return View(Speakers. + FirstOrDefault(a => a.SpeakerId == id)); + } + + + [Route("/Speaker/Evaluations", + Name = "speakerevals")] + public IActionResult Evaluations() + { + return View(); + } + + [Route("/Speaker/EvaluationsCurrent", + Name = "speakerevalscurrent")] + public IActionResult + EvaluationsCurrent(string speakerId, + string currentYear) + { + return View(); + } + + // GET: // + public IActionResult Index() + { + return View(Speakers); + } + } + + public class ModelData + { + public int SpeakerId { get; set; } + } +} \ No newline at end of file diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/PrettyTagHelperTagHelper.cs b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/PrettyTagHelperTagHelper.cs new file mode 100644 index 000000000000..d7857e62062a --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/PrettyTagHelperTagHelper.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text.Encodings.Web; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.AspNetCore.Mvc.ViewFeatures; +using Microsoft.AspNetCore.Razor.Runtime.TagHelpers; +using Microsoft.AspNetCore.Razor.TagHelpers; + +namespace TagHelpersBuiltInAspNetCore +{ + // You may need to install the Microsoft.AspNetCore.Razor.Runtime package into your project + [HtmlTargetElement("PrettyTagHelper")] + public class PrettyTagHelperTagHelper : TagHelper + { + protected IHtmlGenerator Generator { get; } + + [HtmlAttributeNotBound] + [ViewContext] + public ViewContext ViewContext { get; set; } + + [HtmlAttributeName("replacement-text")] + public string RepacementText { get; set; } + + public PrettyTagHelperTagHelper(IHtmlGenerator generator) + { + Generator = generator; + } + + + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + var childContent = await output.GetChildContentAsync(); + var innerHtml = childContent.GetContent(); + + var str = innerHtml; + + + + var strEncoded = WebUtility.HtmlEncode(str); + + var finalStr = str.Replace(RepacementText, strEncoded); + + + + + + output.Content.SetHtmlContent(finalStr); // www version + } + + //public override void Process(TagHelperContext context, TagHelperOutput output) + //{ + // var innerHtml = output.Content.GetContent(); + // output.Content.SetHtmlContent("---" + innerHtml + "---"); // www version + //} + + // public override void Process(TagHelperContext context, TagHelperOutput output) + // { + // var content = output.Content.GetContent(); + + // //var tagBuilder = Generator.GenerateActionLink( + // // ViewContext, + // // "LinkText", + // // "About", + // // "Home", + // // null, + // // null, + // // null, + // // null, + // // null); + + + // output.Content.SetHtmlContent("abcd"); + + + // //var builder = new TagBuilder("a"); + + // //output.Attributes.Add("data-controller", Controller); + // //output.Attributes.Add("data-action", Action); + + // //if (!string.IsNullOrEmpty(Text)) + // //{ + // // builder.InnerHtml.Append(Text); // INNER HTML IS HERE!!! + // //} + // //builder.AddCssClass("btn btn-link"); + // //output.Content.SetContent(builder); + // //base.Process(context, output); + + // } + + + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Program.cs b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Program.cs new file mode 100644 index 000000000000..a679850fba38 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; + +namespace TagHelpersBuiltInAspNetCore +{ + public class Program + { + public static void Main(string[] args) + { + var host = new WebHostBuilder() + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIISIntegration() + .UseStartup() + .Build(); + + host.Run(); + } + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Startup.cs b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Startup.cs new file mode 100644 index 000000000000..cf04ef619c4d --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Startup.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace TagHelpersBuiltInAspNetCore +{ + public class Startup + { + public Startup(IHostingEnvironment env) + { + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables(); + Configuration = builder.Build(); + } + + public IConfigurationRoot Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + // Add framework services. + services.AddMvc(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + { + loggerFactory.AddConsole(Configuration.GetSection("Logging")); + loggerFactory.AddDebug(); + + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + app.UseBrowserLink(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + } + + app.UseStaticFiles(); + + app.UseMvc(routes => + { + // need route and attribute on controller: [Area("Blogs")] + routes.MapRoute(name: "areaRoute", + template: "{area:exists}/{controller=Home}/{action=Index}"); + + // default route for non-areas + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); + } + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/TagHelpersBuiltInAspNetCore.xproj b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/TagHelpersBuiltInAspNetCore.xproj new file mode 100644 index 000000000000..8853e382cbd9 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/TagHelpersBuiltInAspNetCore.xproj @@ -0,0 +1,23 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 1830b28a-9b83-4220-b59b-9ee27650bff8 + TagHelpersBuiltInAspNetCore + .\obj + .\bin\ + v4.6.1 + + + 2.0 + + + + + + + diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/BuiltInTag/AnchorTagHelper.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/BuiltInTag/AnchorTagHelper.cshtml new file mode 100644 index 000000000000..70e4d8e87597 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/BuiltInTag/AnchorTagHelper.cshtml @@ -0,0 +1,166 @@ +@model dynamic + +@{ + ViewBag.Title = "AnchorTagHelper"; +} + + + + + + + + + + + + +

AnchorTagHelper

+ +@Html.Raw(Html.Encode("Speakers"))

+ + + + + + + + + + + + + @*@Html.Raw("Speakers")*@ + + + + @*@Html.Raw(@Html.Encode("Text")) + + + +

+ %3Ca+asp-action%3D%22AboutBlog%22+asp-controller%3D%22Home%22+asp-area%3D%22Blogs%22%3EText%3C%2Fa%3E*@ + + + @*About Speaker Evals*@ + + + @*Simplest Usage
+ About +

+ + + Simplest Usage (being more explicit)
+ About +

+ + + Simplest Usage (being more explicit)
+ About +

+ + + + Simplest Usage (being more explicit)
+ About +

+ + Simplest Usage (being more explicit)
+ Blogs About +

+ + *@ + + @*Ronald + Speaker 11*@ + + @*SpeakerEvals*@ + + + @*@{ + var dict = + new Dictionary + { + {"speakerId", "11"}, + {"currentYear", "true"} + }; + } + SpeakerEvals*@ diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Home/About.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Home/About.cshtml new file mode 100644 index 000000000000..50476d1fbd4c --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Home/About.cshtml @@ -0,0 +1,7 @@ +@{ + ViewData["Title"] = "About"; +} +

@ViewData["Title"].

+

@ViewData["Message"]

+ +

Use this area to provide additional information.

diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Home/Contact.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Home/Contact.cshtml new file mode 100644 index 000000000000..15c12c6d1269 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Home/Contact.cshtml @@ -0,0 +1,17 @@ +@{ + ViewData["Title"] = "Contact"; +} +

@ViewData["Title"].

+

@ViewData["Message"]

+ +
+ One Microsoft Way
+ Redmond, WA 98052-6399
+ P: + 425.555.0100 +
+ +
+ Support: Support@example.com
+ Marketing: Marketing@example.com +
diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Home/Index.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Home/Index.cshtml new file mode 100644 index 000000000000..3cd243ddaab4 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Home/Index.cshtml @@ -0,0 +1,109 @@ +@{ + ViewData["Title"] = "Home Page"; +} + + + + diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Shared/Error.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Shared/Error.cshtml new file mode 100644 index 000000000000..e514139c454a --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Shared/Error.cshtml @@ -0,0 +1,14 @@ +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. +

diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Shared/_Layout.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Shared/_Layout.cshtml new file mode 100644 index 000000000000..97297ade79e7 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Shared/_Layout.cshtml @@ -0,0 +1,67 @@ + + + + + + @ViewData["Title"] - TagHelpersBuiltInAspNetCore + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2016 - TagHelpersBuiltInAspNetCore

+
+
+ + + + + + + + + + + + + @RenderSection("scripts", required: false) + + diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Speaker/Detail.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Speaker/Detail.cshtml new file mode 100644 index 000000000000..8dae850e6cd3 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Speaker/Detail.cshtml @@ -0,0 +1,7 @@ +@model TagHelpersBuiltInAspNetCore.Controllers.ModelData +@{ + ViewBag.Title = "Speaker Detail"; +} + +

Speaker Detail


+Number: @Model.SpeakerId
\ No newline at end of file diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Speaker/Evaluations.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Speaker/Evaluations.cshtml new file mode 100644 index 000000000000..9994dbd3e2ee --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Speaker/Evaluations.cshtml @@ -0,0 +1,7 @@ +@model dynamic + +@{ + ViewBag.Title = "Evaluations"; +} + +

Evaluations

diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Speaker/Index.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Speaker/Index.cshtml new file mode 100644 index 000000000000..b5e3e91042e2 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/Speaker/Index.cshtml @@ -0,0 +1,13 @@ +@model System.Collections.Generic.List + +@{ + ViewBag.Title = "Speakers"; +} + +

Speakers

+ diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/_ViewImports.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/_ViewImports.cshtml new file mode 100644 index 000000000000..43bc039f6c8f --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using TagHelpersBuiltInAspNetCore +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, TagHelpersBuiltInAspNetCore diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/_ViewStart.cshtml b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/_ViewStart.cshtml new file mode 100644 index 000000000000..96b5e60389ba --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + //Layout = "_Layout"; +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/appsettings.json b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/appsettings.json new file mode 100644 index 000000000000..fa8ce71a97a3 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/bower.json b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/bower.json new file mode 100644 index 000000000000..69159b66670a --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/bower.json @@ -0,0 +1,10 @@ +{ + "name": "asp.net", + "private": true, + "dependencies": { + "bootstrap": "3.3.6", + "jquery": "2.2.0", + "jquery-validation": "1.14.0", + "jquery-validation-unobtrusive": "3.2.6" + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/bundleconfig.json b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/bundleconfig.json new file mode 100644 index 000000000000..04754ba7135f --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/bundleconfig.json @@ -0,0 +1,24 @@ +// Configure bundling and minification for the project. +// More info at https://go.microsoft.com/fwlink/?LinkId=808241 +[ + { + "outputFileName": "wwwroot/css/site.min.css", + // An array of relative input file paths. Globbing patterns supported + "inputFiles": [ + "wwwroot/css/site.css" + ] + }, + { + "outputFileName": "wwwroot/js/site.min.js", + "inputFiles": [ + "wwwroot/js/site.js" + ], + // Optionally specify minification options + "minify": { + "enabled": true, + "renameLocals": true + }, + // Optinally generate .map file + "sourceMap": false + } +] diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/project.json b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/project.json new file mode 100644 index 000000000000..dd01a7fa1212 --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/project.json @@ -0,0 +1,65 @@ +{ + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + }, + "Microsoft.AspNetCore.Diagnostics": "1.0.0", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.AspNetCore.Razor.Tools": { + "version": "1.0.0-preview2-final", + "type": "build" + }, + "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", + "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", + "Microsoft.AspNetCore.StaticFiles": "1.0.0", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", + "Microsoft.Extensions.Configuration.Json": "1.0.0", + "Microsoft.Extensions.Logging": "1.0.0", + "Microsoft.Extensions.Logging.Console": "1.0.0", + "Microsoft.Extensions.Logging.Debug": "1.0.0", + "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", + "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0" + }, + + "tools": { + "BundlerMinifier.Core": "2.0.238", + "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", + "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": [ + "dotnet5.6", + "portable-net45+win8" + ] + } + }, + + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + + "runtimeOptions": { + "configProperties": { + "System.GC.Server": true + } + }, + + "publishOptions": { + "include": [ + "wwwroot", + "Views", + "Areas/**/Views", + "appsettings.json", + "web.config" + ] + }, + + "scripts": { + "prepublish": [ "bower install", "dotnet bundle" ], + "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] + } +} diff --git a/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/web.config b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/web.config new file mode 100644 index 000000000000..dc0514fca5eb --- /dev/null +++ b/aspnetcore/mvc/views/tag-helpers/built-in/sample/TagHelpersBuiltInAspNetCore/src/TagHelpersBuiltInAspNetCore/web.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/aspnetcore/toc.md b/aspnetcore/toc.md index 35c5deec439e..563e6ba0d497 100644 --- a/aspnetcore/toc.md +++ b/aspnetcore/toc.md @@ -77,6 +77,11 @@ ### [🔧 HTML helpers](mvc/views/html-helpers.md) ### [Tag helpers](mvc/views/tag-helpers/intro.md) #### [Authoring tag helpers](mvc/views/tag-helpers/authoring.md) +#### [Built-in Tag Helpers](mvc/views/tag-helpers/built-in/index.md) +##### [Tag Helpers used with forms](mvc/views/working-with-forms.md) +##### [Anchor Tag Helper](mvc/views/tag-helpers/built-in/AnchorTagHelper.md) +##### [Cache Tag Helper](mvc/views/tag-helpers/built-in/CacheTagHelper.md) +##### [Image Tag Helper](mvc/views/tag-helpers/built-in/ImageTagHelper.md) ### [Partial views](mvc/views/partial.md) ### [Dependency injection into views](mvc/views/dependency-injection.md) ### [View components](mvc/views/view-components.md)