• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class ExtensionUrlProvider

This abstract class is to provide a inherited base class for a custom module friendly url provider. All public methods must be overridden to provide the basis for a custom module provider.

Inheritance
System.Object
ExtensionUrlProvider
Namespace: DotNetNuke.Entities.Urls
Assembly: DotNetNuke.dll
Syntax
public abstract class ExtensionUrlProvider : object

Properties

| Improve this Doc View Source

ProviderConfig

This abstract class is to provide a inherited base class for a custom module friendly url provider. All public methods must be overridden to provide the basis for a custom module provider.

Declaration
public ExtensionUrlProviderInfo ProviderConfig { get; }
Property Value
Type Description
ExtensionUrlProviderInfo

Methods

| Improve this Doc View Source

AlwaysCallForRewrite(Int32)

This method is called to check whether to do a Url Rewrite on all Tabs specified by the provider.

Declaration
public virtual bool AlwaysCallForRewrite(int portalId)
Parameters
Type Name Description
System.Int32 portalId

The current portalId.

Returns
Type Description
System.Boolean

True if the rewriter should be called, even if there are no Url parameters (ie, just plain DNN page Url). False if not. Does not affect the calling of this provider when there are parameters supplied in the Url - that is determined by the tabIds property of the provider.

| Improve this Doc View Source

AlwaysUsesDnnPagePath(Int32)

When true, output Urls from the provider for the specified portalId always include the current DotNetNuke page path (ie example.com/pagename/friendlyUrl) When false, output Urls from the provider for the specified portalId may sometimes not include the current DotNetNUke page path (ie example.com/friendlyUrl).

Declaration
public abstract bool AlwaysUsesDnnPagePath(int portalId)
Parameters
Type Name Description
System.Int32 portalId
Returns
Type Description
System.Boolean

true if this provider always uses the DNN page path for the given portalId, otherwise false.

Remarks

Defaults to true. Must be set to false by the provider if any call to the 'ChangeFriendlyUrl' method results in the output parameter 'useDnnPagePath' is false. If 'false' is possible, then 'false' must be returned in this method.

| Improve this Doc View Source

ChangeFriendlyUrl(TabInfo, String, FriendlyUrlOptions, String, ref String, out Boolean, ref List<String>)

Generates a new friendly Url based on the parameters supplied.

Declaration
public abstract string ChangeFriendlyUrl(TabInfo tab, string friendlyUrlPath, FriendlyUrlOptions options, string cultureCode, ref string endingPageName, out bool useDnnPagePath, ref List<string> messages)
Parameters
Type Name Description
TabInfo tab

The current Tab the Friendly Url is for.

System.String friendlyUrlPath

The current friendly Url Path (minus alias) as generated by the Advanced Friendly Url provider.

FriendlyUrlOptions options

The current friendly Url options that apply to the current portal, as configured within the Extension Url Provider settings. These include space replacement values and other settings which should be incorporated into the Friendly Url generation.

System.String cultureCode
System.String endingPageName

The 'pageName' value that comes from the FriendlyUrl API of DNN. Normally this is the 'default.aspx' value (DotNetNuke.Common.Globals.glbDefaultPage). A value of 'default.aspx' is discarded. However, it may be a different value for other modules and if not default.aspx will be appended to the end of the Url. This is a ref parameter, so it can either be left as-is, or changed to default.aspx or "" if no specific value is required.

System.Boolean useDnnPagePath

Output parameter, must be set by module Friendly Url Provider. If true, the /pagename/ part of the Url will be removed, and the Url path will be relative from the site root (example.com/custom-module-path instead of example.com/pagename/custom-module-path).

List<System.String> messages

A list of information messages used for both debug output and UI information. Add any informational message to this collection if desired.

Returns
Type Description
System.String

Friendly Url for specified values. Return friendlyUrlPath if no change is made.

Remarks

Note using 'useDnnPagePath' = true requires having a specific tab returned from the TransformFriendlyUrlToQueryString below. Usage of the 'useDnnPagePath' implies the TransformFriendlyUrlToQueryString method returns a ?tabid=xx value in the querystring. It also means the provider level property 'AlwaysUsesDnnPagePath' must return 'false'.

| Improve this Doc View Source

CheckForRedirect(Int32, Int32, String, Uri, NameValueCollection, FriendlyUrlOptions, out String, ref List<String>)

This abstract class is to provide a inherited base class for a custom module friendly url provider. All public methods must be overridden to provide the basis for a custom module provider.

Declaration
public abstract bool CheckForRedirect(int tabId, int portalid, string httpAlias, Uri requestUri, NameValueCollection queryStringCol, FriendlyUrlOptions options, out string redirectLocation, ref List<string> messages)
Parameters
Type Name Description
System.Int32 tabId
System.Int32 portalid
System.String httpAlias
Uri requestUri
NameValueCollection queryStringCol
FriendlyUrlOptions options
System.String redirectLocation
List<System.String> messages
Returns
Type Description
System.Boolean

true if there should be a redirect, otherwise false.

| Improve this Doc View Source

CleanNameForUrl(String, FriendlyUrlOptions, out Boolean)

This abstract class is to provide a inherited base class for a custom module friendly url provider. All public methods must be overridden to provide the basis for a custom module provider.

Declaration
protected string CleanNameForUrl(string urlValue, FriendlyUrlOptions options, out bool replacedUnwantedChars)
Parameters
Type Name Description
System.String urlValue
FriendlyUrlOptions options
System.Boolean replacedUnwantedChars
Returns
Type Description
System.String
| Improve this Doc View Source

CleanNameForUrl(String, FriendlyUrlOptions)

This abstract class is to provide a inherited base class for a custom module friendly url provider. All public methods must be overridden to provide the basis for a custom module provider.

Declaration
protected string CleanNameForUrl(string urlValue, FriendlyUrlOptions options)
Parameters
Type Name Description
System.String urlValue
FriendlyUrlOptions options
Returns
Type Description
System.String
| Improve this Doc View Source

CreateQueryStringFromParameters(String[], Int32)

This abstract class is to provide a inherited base class for a custom module friendly url provider. All public methods must be overridden to provide the basis for a custom module provider.

Declaration
protected string CreateQueryStringFromParameters(string[] urlParms, int skipUpToPosition)
Parameters
Type Name Description
System.String[] urlParms
System.Int32 skipUpToPosition
Returns
Type Description
System.String
| Improve this Doc View Source

EnsureLeadingChar(String, String)

This abstract class is to provide a inherited base class for a custom module friendly url provider. All public methods must be overridden to provide the basis for a custom module provider.

Declaration
protected string EnsureLeadingChar(string leading, string path)
Parameters
Type Name Description
System.String leading
System.String path
Returns
Type Description
System.String
| Improve this Doc View Source

EnsureNotLeadingChar(String, String)

This abstract class is to provide a inherited base class for a custom module friendly url provider. All public methods must be overridden to provide the basis for a custom module provider.

Declaration
public string EnsureNotLeadingChar(string leading, string path)
Parameters
Type Name Description
System.String leading
System.String path
Returns
Type Description
System.String
| Improve this Doc View Source

GetProviderPortalSettings()

This module returns any custom settings for the provider in a key/value pair. This is used when any customised settings are saved to the web.config file.

Declaration
public abstract Dictionary<string, string> GetProviderPortalSettings()
Returns
Type Description
Dictionary<System.String, System.String>

A dictionary of key/value pairs, where the key represents the web.config attribute name, and the value is the value to be stored in the web.config file.

Remarks

Note: the key values are case sensitive, and should match any values read from the attributes collection in the provider constructor. If the provider has no custom attributes, return null or an empty dictionary. To remove a setting, add the value as a null. Null values in the dictionary are removed as attributes.

| Improve this Doc View Source

TransformFriendlyUrlToQueryString(String[], Int32, Int32, FriendlyUrlOptions, String, PortalAliasInfo, ref List<String>, out Int32, out String)

Transforms a friendly Url into a querystring. Used as input into the rewriting process, after the Url Rewriting process has identified the correct DNN Page.

Declaration
public abstract string TransformFriendlyUrlToQueryString(string[] urlParms, int tabId, int portalId, FriendlyUrlOptions options, string cultureCode, PortalAliasInfo portalAlias, ref List<string> messages, out int status, out string location)
Parameters
Type Name Description
System.String[] urlParms

string array of the friendly Url Path elements, separated by /.

System.Int32 tabId

TabId of page the Friendly Url.

System.Int32 portalId

PortalId of the Friendly Url.

FriendlyUrlOptions options
System.String cultureCode
PortalAliasInfo portalAlias
List<System.String> messages
System.Int32 status
System.String location
Returns
Type Description
System.String

Querystring value in key=value format, which will be used as an input to the rewriting function.

Remarks

This method will be only called if there is no match between the Page Index entries this Provider supplies via the 'CreatePageIndex' method. This method is called when a DNN page match is found in the requested path, and there are other parameters behind the page path. You should only return a TabId in the querystring, when the ChangeFriendlyUrl function is returning 'true' for the output value of 'useDnnPagePath'.

Examples

Given a Url of example.com/pagename/key/value - this method will be called with key,value in the urlParms array with a page match on 'pagename'. The method should return 'key=value'. Or, if given a Url of example.com/pagename/my-friendly-module-url, it should transform 'my-friendly-module-url' into whatever the module actually uses to build content. This might mean returning 'article=2354' derived from doing a specific lookup on 'my-friendly-module-url'. Warning: It's unwise to do a specific database lookup for each call of this method. This method needs to be high-performance so should use a stateless method (ie, regex parse) or, if looking up database values, cached hashtables or thread-safe dictionaries.

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS