Click or drag to resize
URLHelper Class
Url processing methods.
Inheritance Hierarchy
SystemObject
  CMS.HelpersURLHelper

Namespace: CMS.Helpers
Assembly: CMS.Helpers (in CMS.Helpers.dll) Version: 10.0.0
Syntax
C#
public class URLHelper

The URLHelper type exposes the following members.

Constructors
  NameDescription
Public methodURLHelper
Top
Fields
  NameDescription
Public fieldStatic memberDEFAULT_HTTP_PORT
Constant for HTTP port.
Public fieldStatic memberDEFAULT_HTTPS_PORT
Constant for HTTPS port.
Public fieldStatic memberSYSTEM_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.
Top
Properties
  NameDescription
Public propertyStatic memberAliasPathParameterName
Alias path query parameter name.
Public propertyStatic memberCustomTheme
Custom theme name.
Public propertyStatic memberDefaultTheme
Default theme name.
Public propertyStatic memberImagesDirectory
Resolved base directory for the images.
Public propertyStatic memberLanguageParameterName
Language query parameter name.
Public propertyStatic memberPortalTemplatePage
Page used as the portal template base page
Public propertyStatic memberRegExMakeLinksAbsolute
Make links absolute regular expression.
Public propertyStatic memberSSLUrlPort
Application's SSL URL port.
Public propertyStatic memberUrlPort
Application's URL port.
Public propertyStatic memberUseTrailingSlashOnlyForExtensionLess
Gets the value that indicates whether trailing slash handling should be processed for all requests or only for extension less requests
Top
Methods
  NameDescription
Public methodStatic memberAddHTTPToUrl
Adds HTTP protocol to URL if it's not contain HTTP or HTTPS.
Public methodStatic memberAddParameterToUrl
Adds parameter to specified URL.
Public methodStatic memberAddPrefixToUrl
Add URL prefix to the url.
Public methodStatic memberAddUrlParameter
Add parameter to query string, queryStringValue MUST start with "?".
Public methodStatic memberAppendQuery
Appends the given query string to the URL. If the URL already contains query string, merges both.
Public methodStatic memberClientRedirect
Performs client redirect.
Public methodStatic memberCombinePath
Resolves given path to be absolute (combines with given paths).
Public methodStatic memberContainsProtocol
Returns true if the URL contains the protocol part.
Public methodStatic memberCorrectDomainName
Removes white characters from the beginning and end. Also removes protocol declarations and 'www.' string from begin.
Public methodStatic memberDomainMatch
Returns true if the given domain names match.
Public methodStatic memberEnsureHashToQueryParameters
Replaces {hash} macro by hash code for given query string parameters.
Public methodStatic memberEnsureProperPort
Sets proper port according to SSL option and custom port.
Public methodStatic memberEnsureURLPrefix(String, String, String)
Ensures that the given URLs has the given prefix
Public methodStatic memberEnsureURLPrefix(String, String, String, URLHelperPathModifierHandler)
Ensures that the given URLs has the given prefix
Public methodStatic memberEscapeSpecialCharacters
Ensures URL without forbidden characters (%, &, #).
Public methodStatic memberForbiddenCharactersReplacement
Returns string containing replacement for forbidden characters (chars that can't be used in node alias and in the file system).
Public methodStatic memberForbiddenURLCharacters
Returns string containing all forbidden characters that cannot be used in node alias and in the file system.
Public methodStatic memberGetAbsoluteUrl(String)
Returns the absolute URL (including port) representation for the given relative URL, uses current domain and application path.
Public methodStatic memberGetAbsoluteUrl(String, String)
Returns the absolute URL (including port) representation for the given relative URL, uses given domain and application path.
Public methodStatic memberGetAbsoluteUrl(String, String, String, String)
Returns the absolute URL for the given relative URL based on the given paths.
Public methodStatic memberGetAllowedURLCharacters
Returns regular expression for allowed URL characters.
Public methodStatic memberGetApplicationUrl
Returns current application URL (absolute), without trailing slashes.
Public methodStatic memberGetApplicationUrl(String)
Returns the application URL (absolute), without trailing slashes.
Public methodStatic memberGetAppRelativePath
Returns the relative path for specified URL.
Public methodStatic memberGetCaseRedirectEnum
Gets the settings for the URL case rules.
Public methodStatic memberGetDomain
Returns domain or domain with port if present from specific URL.
Public methodStatic memberGetDomainName
Returns name (e.g. localhost) without port, www. prefix and application path.
Public methodStatic memberGetFriendlyExtension
Returns first of the friendly extensions from settings.
Public methodStatic memberGetFriendlyExtensions
Returns string with all friendly URL extensions separated by semicolon.
Public methodStatic memberGetFullApplicationUrl
Returns current application URL (absolute) with port, without trailing slashes.
Public methodStatic memberGetIPv4Address
Returns equivalent IPv4 address for IPv6 address specified by parameter
Public methodStatic memberGetPhysicalPath
Returns the physical file path that corresponds to the specified virtual path on the web server.
Public methodStatic memberGetProtocol
Returns protocol from url. e.g. http, https, ftp, ... If no protocol found, null is returned.
Public methodStatic memberGetQuery
Gets the query from URL.
Public methodStatic memberGetQueryValue(String, String)
Gets the query string value for specified key name.
Public methodStatic memberGetQueryValue(String, String, Boolean)
Gets the query string value for specified key name.
Public methodStatic memberGetSafeFileName(String, String)
Returns the safe equivalent to the given file name (with extension).
Public methodStatic memberGetSafeFileName(String, String, Boolean)
Returns the safe equivalent to the given file name.
Public methodStatic memberGetSafeUrlPart
Returns the safe part of URL. This method doesn't process complete URL it handles only part of URL.
Public methodStatic memberGetUrlExtension
Gets the extension for the given URL. Returns the extension with the dot, e.g. ".gif"
Public methodStatic memberGetUrlParameter
Returns value of query parameter from URL.
Public methodStatic memberGetVirtualPath
Converts the absolute path to the virtual.
Public methodStatic memberCheckPrefix
Checks the URL prefix. If the prefix is present, returns true and removes the prefix from the URL if removePrefix is true.
Public methodStatic memberCheckPrefixes
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.
Public methodStatic memberIsAnchor
Returns true for url's starting with hash (#) character.
Public methodStatic memberIsExcluded(String, String)
Checks if page with specified relative path is excluded from excluded paths.
Public methodStatic memberIsExcluded(String, String)
Checks if page with specified relative path is excluded from excluded paths.
Public methodStatic memberIsExcludedCustom
Checks if page with specified relative path is excluded from excluded paths.
Public methodStatic memberIsExcludedSystem
Checks if page with specified relative path is excluded from system paths.
Public methodStatic memberIsExcludedSystemEnum
Checks if page with specified relative path is excluded from system paths and returns the category of the excluded page.
Public methodStatic memberIsLocalUrl
Returns true if the given URL is local.
Public methodStatic memberIsPostback
Returns true if current request is post-back.
Public methodStatic memberIsSystemPath
Returns true if the given path is a system path. The path is expected to be lowercase and start with slash, e.g. "/cmsmodules/..."
Public methodStatic memberIsTldDomain
Returns true if domain is IP address or top level domain e.g localhost
Public methodStatic memberLimitURLReplacements
Limits multiple replacements, starting and trailing replacements from URL. Can be disabled by app key: CMSLimitUrlReplacement.
Public methodStatic memberLocalRedirect
Redirects (302 HTTP status code) the response using specified URL in case it is local, otherwise redirects to ApplicationPath
Public methodStatic memberMakeLinksAbsolute(String)
Returns the absolute representation of the HTML links (image paths ...).
Public methodMakeLinksAbsolute(String, String)
Returns the absolute representation of the HTML links (image paths ...).
Public methodStatic memberMergeQueryStrings
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.
Public methodStatic memberPropagateUrlParameters
Propagates the URL parameters from current URL to the given URL
Public methodStatic memberRedirect
Redirects the response using specified URL (302 HTTP status code).
Public methodStatic memberRedirectPermanent
Redirects the response using specified URL using permanent redirection using 301.
Public methodStatic memberRefreshCurrentPage
Refreshes the current page by doing a redirect to self
Public methodStatic memberRemoveApplicationPath
Removes the Application path from the URL.
Public methodStatic memberRemoveEmptyQueryParameters
Removes empty query parameters. (eg. '?param=' -> '')
Public methodStatic memberRemoveExtension
Removes the potential extension from the given path.
Public methodStatic memberRemoveFirstPart
Returns the string with first selector removed.
Public methodStatic memberRemoveParameterFromUrl
Removes specified parameters from the given URL.
Public methodStatic memberRemoveParametersFromUrl
Removes specified parameters from the given URL.
Public methodStatic memberRemovePathInfo
Removes the path info from URL.
Public methodStatic memberRemovePort
Removes the port part from the domain name.
Public methodStatic memberRemovePortFromURL
Removes the port part from the whole URL.
Public methodStatic memberRemoveProtocol
Removes the protocol part from the URL.
Public methodStatic memberRemoveProtocolAndDomain
Removes the protocol and domain part from the URL.
Public methodStatic memberRemoveQuery
Removes the query from URL.
Public methodStatic memberRemoveTrailingSlashFromURL
Removes trailing slash from URL.
Public methodStatic memberRemoveUrlParameter
Remove parameter from query string.
Public methodStatic memberRemoveUrlParameters
Removes the given URL parameters
Public methodStatic memberRemoveWWW
Trim www if input text starts with it.
Public methodStatic memberResolveClientUrl
Resolves and combine client URL with base URL.
Public methodStatic memberResolveUrl
Resolves an application relative URL to the absolute form.
Public methodStatic memberResponseRedirect
Redirects the response using specified URL using standard redirection with Response.Redirect.
Public methodStatic memberSeeOther
Redirects the client to another URL using the GET method (303 H).
Public methodStatic memberUnMapPath
Converts the physical file path to virtual path within the web application.
Public methodStatic memberUnResolveUrl
Un-resolves the given URL (replaces application path with ~).
Public methodStatic memberUpdateParameterInUrl
Update parameter in specified URL.
Public methodStatic memberURLDecode
URL decoding function.
Public methodStatic memberURLEncode
URL encoding function.
Public methodStatic memberUrlEncodeQueryString
URL encodes query string in given URL. Needs HttpContext.
Public methodStatic memberUseLangPrefixForUrls
Returns value that indicates whether lang prefix should be used for specified site.
Public methodStatic memberUsePermanentRedirect
If true, permanent redirection (301) is used instead of regular (302) redirection.
Public methodStatic memberUseURLsWithTrailingSlash
Gets the settings for the URL trailing slash rules.
Top
Events
  NameDescription
Public eventStatic memberOnBeforeGetSafeUrlPart
Occurs when the GetSafeUrlPart method is called, returns false if the original method ensuring safe URL part should not be used.
Top
See Also