URLHelper Class |
Namespace: CMS.Helpers
public class URLHelper
The URLHelper type exposes the following members.
Name | Description | |
---|---|---|
DEFAULT_HTTP_PORT |
Constant for HTTP port.
| |
DEFAULT_HTTPS_PORT |
Constant for HTTPS port.
| |
SYSTEM_QUERY_PARAMETER |
Used in system requests of live site pages, it prevents the system to log statistics or activities, e.g. when dynamic newsletter is generated.
|
Name | Description | |
---|---|---|
AliasPathParameterName |
Alias path query parameter name.
| |
CustomTheme |
Custom theme name.
| |
DefaultTheme |
Default theme name.
| |
ImagesDirectory |
Resolved base directory for the images.
| |
LanguageParameterName |
Language query parameter name.
| |
PortalTemplatePage |
Page used as the portal template base page
| |
RegExMakeLinksAbsolute |
Make links absolute regular expression.
| |
SSLUrlPort |
Application's SSL URL port.
| |
UrlPort |
Application's URL port.
| |
UseTrailingSlashOnlyForExtensionLess |
Gets the value that indicates whether trailing slash handling
should be processed for all requests or only for extension less requests
|
Name | Description | |
---|---|---|
AddHTTPToUrl |
Adds HTTP protocol to URL if it's not contain HTTP or HTTPS.
| |
AddParameterToUrl |
Adds parameter to specified URL.
| |
AddPrefixToUrl |
Add URL prefix to the url.
| |
AddUrlParameter |
Add parameter to query string, queryStringValue MUST start with "?".
| |
AppendQuery |
Appends the given query string to the URL. If the URL already contains query string, merges both.
| |
ClientRedirect |
Performs client redirect.
| |
CombinePath |
Resolves given path to be absolute (combines with given paths).
| |
ContainsProtocol |
Returns true if the URL contains the protocol part.
| |
CorrectDomainName |
Removes white characters from the beginning and end. Also removes protocol declarations and 'www.' string from begin.
| |
DomainMatch |
Returns true if the given domain names match.
| |
EnsureHashToQueryParameters |
Replaces {hash} macro by hash code for given query string parameters.
| |
EnsureProperPort |
Sets proper port according to SSL option and custom port.
| |
EnsureURLPrefix(String, String, String) |
Ensures that the given URLs has the given prefix
| |
EnsureURLPrefix(String, String, String, URLHelperPathModifierHandler) |
Ensures that the given URLs has the given prefix
| |
EscapeSpecialCharacters |
Ensures URL without forbidden characters (%, &, #).
| |
ForbiddenCharactersReplacement |
Returns string containing replacement for forbidden characters (chars that can't be used in node alias and in the file system).
| |
ForbiddenURLCharacters |
Returns string containing all forbidden characters that cannot be used in node alias and in the file system.
| |
GetAbsoluteUrl(String) |
Returns the absolute URL (including port) representation for the given relative URL, uses current domain and application path.
| |
GetAbsoluteUrl(String, String) |
Returns the absolute URL (including port) representation for the given relative URL, uses given domain and application path.
| |
GetAbsoluteUrl(String, String, String, String) |
Returns the absolute URL for the given relative URL based on the given paths.
| |
GetAllowedURLCharacters |
Returns regular expression for allowed URL characters.
| |
GetApplicationUrl |
Returns current application URL (absolute), without trailing slashes.
| |
GetApplicationUrl(String) |
Returns the application URL (absolute), without trailing slashes.
| |
GetAppRelativePath |
Returns the relative path for specified URL.
| |
GetCaseRedirectEnum |
Gets the settings for the URL case rules.
| |
GetDomain |
Returns domain or domain with port if present from specific URL.
| |
GetDomainName |
Returns name (e.g. localhost) without port, www. prefix and application path.
| |
GetFriendlyExtension |
Returns first of the friendly extensions from settings.
| |
GetFriendlyExtensions |
Returns string with all friendly URL extensions separated by semicolon.
| |
GetFullApplicationUrl |
Returns current application URL (absolute) with port, without trailing slashes.
| |
GetIPv4Address |
Returns equivalent IPv4 address for IPv6 address specified by parameter
| |
GetPhysicalPath |
Returns the physical file path that corresponds to the specified virtual path on the web server.
| |
GetProtocol |
Returns protocol from url.
e.g. http, https, ftp, ...
If no protocol found, null is returned.
| |
GetQuery |
Gets the query from URL.
| |
GetQueryValue(String, String) |
Gets the query string value for specified key name.
| |
GetQueryValue(String, String, Boolean) |
Gets the query string value for specified key name.
| |
GetSafeFileName(String, String) |
Returns the safe equivalent to the given file name (with extension).
| |
GetSafeFileName(String, String, Boolean) |
Returns the safe equivalent to the given file name.
| |
GetSafeUrlPart |
Returns the safe part of URL. This method doesn't process complete URL it handles only part of URL.
| |
GetUrlExtension |
Gets the extension for the given URL. Returns the extension with the dot, e.g. ".gif"
| |
GetUrlParameter |
Returns value of query parameter from URL.
| |
GetVirtualPath |
Converts the absolute path to the virtual.
| |
CheckPrefix |
Checks the URL prefix. If the prefix is present, returns true and removes the prefix from the URL if removePrefix is true.
| |
CheckPrefixes |
Checks the URL prefixes. If one of the the prefixes is present, returns true and removes the prefix from the URL if removePrefix is true.
| |
IsAnchor |
Returns true for url's starting with hash (#) character.
| |
IsExcluded(String, String) |
Checks if page with specified relative path is excluded from excluded paths.
| |
IsExcluded(String, String) |
Checks if page with specified relative path is excluded from excluded paths.
| |
IsExcludedCustom |
Checks if page with specified relative path is excluded from excluded paths.
| |
IsExcludedSystem |
Checks if page with specified relative path is excluded from system paths.
| |
IsExcludedSystemEnum |
Checks if page with specified relative path is excluded from system paths and returns the category of the excluded page.
| |
IsLocalUrl |
Returns true if the given URL is local.
| |
IsPostback |
Returns true if current request is post-back.
| |
IsSystemPath |
Returns true if the given path is a system path. The path is expected to be lowercase and start with slash, e.g. "/cmsmodules/..."
| |
IsTldDomain |
Returns true if domain is IP address or top level domain e.g localhost
| |
LimitURLReplacements |
Limits multiple replacements, starting and trailing replacements from URL. Can be disabled by app key: CMSLimitUrlReplacement.
| |
LocalRedirect |
Redirects (302 HTTP status code) the response using specified URL in case it is local,
otherwise redirects to ApplicationPath | |
MakeLinksAbsolute(String) |
Returns the absolute representation of the HTML links (image paths ...).
| |
MakeLinksAbsolute(String, String) |
Returns the absolute representation of the HTML links (image paths ...).
| |
MergeQueryStrings |
Merges two query strings. Query string parameters should (but don't have to) start with question mark
but they definitely must omit path part of URL.
| |
PropagateUrlParameters |
Propagates the URL parameters from current URL to the given URL
| |
Redirect |
Redirects the response using specified URL (302 HTTP status code).
| |
RedirectPermanent |
Redirects the response using specified URL using permanent redirection using 301.
| |
RefreshCurrentPage |
Refreshes the current page by doing a redirect to self
| |
RemoveApplicationPath |
Removes the Application path from the URL.
| |
RemoveEmptyQueryParameters |
Removes empty query parameters. (eg. '?param=' -> '')
| |
RemoveExtension |
Removes the potential extension from the given path.
| |
RemoveFirstPart |
Returns the string with first selector removed.
| |
RemoveParameterFromUrl |
Removes specified parameters from the given URL.
| |
RemoveParametersFromUrl |
Removes specified parameters from the given URL.
| |
RemovePathInfo |
Removes the path info from URL.
| |
RemovePort |
Removes the port part from the domain name.
| |
RemovePortFromURL |
Removes the port part from the whole URL.
| |
RemoveProtocol |
Removes the protocol part from the URL.
| |
RemoveProtocolAndDomain |
Removes the protocol and domain part from the URL.
| |
RemoveQuery |
Removes the query from URL.
| |
RemoveTrailingSlashFromURL |
Removes trailing slash from URL.
| |
RemoveUrlParameter |
Remove parameter from query string.
| |
RemoveUrlParameters |
Removes the given URL parameters
| |
RemoveWWW |
Trim www if input text starts with it.
| |
ResolveClientUrl |
Resolves and combine client URL with base URL.
| |
ResolveUrl |
Resolves an application relative URL to the absolute form.
| |
ResponseRedirect |
Redirects the response using specified URL using standard redirection with Response.Redirect.
| |
SeeOther |
Redirects the client to another URL using the GET method (303 H).
| |
UnMapPath |
Converts the physical file path to virtual path within the web application.
| |
UnResolveUrl |
Un-resolves the given URL (replaces application path with ~).
| |
UpdateParameterInUrl |
Update parameter in specified URL.
| |
URLDecode |
URL decoding function.
| |
URLEncode |
URL encoding function.
| |
UrlEncodeQueryString |
URL encodes query string in given URL. Needs HttpContext.
| |
UseLangPrefixForUrls |
Returns value that indicates whether lang prefix should be used for specified site.
| |
UsePermanentRedirect |
If true, permanent redirection (301) is used instead of regular (302) redirection.
| |
UseURLsWithTrailingSlash |
Gets the settings for the URL trailing slash rules.
|
Name | Description | |
---|---|---|
OnBeforeGetSafeUrlPart |
Occurs when the GetSafeUrlPart method is called, returns false if the original method ensuring safe URL part should not be used.
|