C# Класс Decision.Common.Filters.RedirectToCanonicalUrlAttribute

Наследование: System.Web.Mvc.FilterAttribute, IAuthorizationFilter
Показать файл Открыть проект

Открытые методы

Метод Описание
OnAuthorization ( System.Web.Mvc.AuthorizationContext filterContext ) : void

Determines whether the HTTP request contains a non-canonical URL using TryGetCanonicalUrl, if it doesn't calls the HandleNonCanonicalRequest method.

RedirectToCanonicalUrlAttribute ( bool appendTrailingSlash, bool lowercaseUrls ) : System

Initializes a new instance of the RedirectToCanonicalUrlAttribute class.

Защищенные методы

Метод Описание
HandleNonCanonicalRequest ( System.Web.Mvc.AuthorizationContext filterContext, string canonicalUrl ) : void

Handles HTTP requests for URL's that are not canonical. Performs a 301 Permanent Redirect to the canonical URL.

HasNoTrailingSlashAttribute ( System.Web.Mvc.AuthorizationContext filterContext ) : bool

Determines whether the specified action or its controller has the NoTrailingSlashAttribute attribute specified.

TryGetCanonicalUrl ( System.Web.Mvc.AuthorizationContext filterContext, string &canonicalUrl ) : bool

Determines whether the specified URl is canonical and if it is not, outputs the canonical URL.

Описание методов

HandleNonCanonicalRequest() защищенный Метод

Handles HTTP requests for URL's that are not canonical. Performs a 301 Permanent Redirect to the canonical URL.
protected HandleNonCanonicalRequest ( System.Web.Mvc.AuthorizationContext filterContext, string canonicalUrl ) : void
filterContext System.Web.Mvc.AuthorizationContext An object that encapsulates information that is required in order to use the /// attribute.
canonicalUrl string The canonical URL.
Результат void

HasNoTrailingSlashAttribute() защищенный Метод

Determines whether the specified action or its controller has the NoTrailingSlashAttribute attribute specified.
protected HasNoTrailingSlashAttribute ( System.Web.Mvc.AuthorizationContext filterContext ) : bool
filterContext System.Web.Mvc.AuthorizationContext The filter context.
Результат bool

OnAuthorization() публичный Метод

Determines whether the HTTP request contains a non-canonical URL using TryGetCanonicalUrl, if it doesn't calls the HandleNonCanonicalRequest method.
The parameter is null.
public OnAuthorization ( System.Web.Mvc.AuthorizationContext filterContext ) : void
filterContext System.Web.Mvc.AuthorizationContext An object that encapsulates information that is required in order to use the /// attribute.
Результат void

RedirectToCanonicalUrlAttribute() публичный Метод

Initializes a new instance of the RedirectToCanonicalUrlAttribute class.
public RedirectToCanonicalUrlAttribute ( bool appendTrailingSlash, bool lowercaseUrls ) : System
appendTrailingSlash bool If set to true append trailing slashes, otherwise strip trailing /// slashes.
lowercaseUrls bool If set to true lower-case all URL's.
Результат System

TryGetCanonicalUrl() защищенный Метод

Determines whether the specified URl is canonical and if it is not, outputs the canonical URL.
protected TryGetCanonicalUrl ( System.Web.Mvc.AuthorizationContext filterContext, string &canonicalUrl ) : bool
filterContext System.Web.Mvc.AuthorizationContext An object that encapsulates information that is required in order to use the /// attribute.
canonicalUrl string The canonical URL.
Результат bool