Interfaces

Project

Pages Html

NuGet packageOwin.Framework.Pages.Html
GitHub sourceOwinFramework.Pages.Html

Home |  Readme

[IsPage] attribute | The OWIN Framework Pages

The [IsPage] Attribute

Attach this attribute to a class to identify it as a webpage. To register this page with the router and send requests to it you must get the fluent builder to scan the assembly containing your class.

Example Usage

    [IsPage]
    [Route("/", Method.Get)]
    [UsesLayout("homePageLayout")]
    internal class HomePage { }

Example Startup Code

    var fluentBuilder = ninject.Get<IFluentBuilder>();
    fluentBuilder.Register(Assembly.GetExecutingAssembly(), t => ninject.Get(t));

The [IsPage()] attribute has the following properties you can set.

Name

You do not have to choose a name for your page, but it makes sense to do so for debugging purposes.

CanonicalUrl

If there is more than one URL that returns this page's content, then you are strongly advised to set the CanonicalUrl property. This tells search engines that you deliberately made more than one URL for the page and tells the search engine which one to direct trafic to.

If you have multiple URLs for a page and do not set the CanonicalUrl property then the page rank will be significantly reduced by the search engines.