This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
Absolute URL Methods Added to UrlHelper, Canonical URL Support and RequireHttpsAttribute Fix #2810
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
UrlHelper
Following on from #1966 where a Link method was added to
UrlHelper
which requires a route name and route values. Having similar methods for 'Action' (controller and action name) and 'Content' (images and static content) would be really useful too. Here are some places where I find having 'Absolute Content' useful:I have these methods in my ASP.NET MVC 6 Boilerplate Framework NuGet package (Note that I add the word 'Absolute' at the beginning of the function. The current method is named 'Link' but it uses route names, so it could be named better at the very least).
Canonical URL's for Better Search Engine Optimization (SEO)
Support for canonical URL's with the RedirectToCanonicalUrlAttribute and NoTrailingSlashAttribute filters. Performing 301 permanent redirects to the canonical URL of a resource is the correct approach according to both Google and Bing. The RedirectToCanonicalUrlAttribute filter helps achieve this in conjunction with the RouteOptions (AppendTrailingSlash and LowercaseUrls). See my blog for full details.