Class UrlUtils
Provides utilities for dealing with DNN's URLs. Consider using
Inheritance
Namespace: DotNetNuke.Common.Utilities
Assembly: DotNetNuke.dll
Syntax
public static class UrlUtils : object
Methods
| Improve this Doc View SourceClosePopUp(Boolean, String, Boolean)
Creates a URL (or script) to close a pop-up.
Declaration
public static string ClosePopUp(bool refresh, string url, bool onClickEvent)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | refresh | Whether to refresh the page when the pop-up is closed. |
System.String | url | The URL. |
System.Boolean | onClickEvent | Whether to generate a script for an onClick event (rather than a URL with a |
Returns
Type | Description |
---|---|
System.String | The URL or script. |
Combine(String, String)
Combines two URLs, trimming any slashes between them.
Declaration
public static string Combine(string baseUrl, string relativeUrl)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseUrl | The base URL. |
System.String | relativeUrl | The URL to add to the base URL. |
Returns
Type | Description |
---|---|
System.String | A new URL that combines |
DecodeParameter(String)
Decodes a base64 encoded value generated via EncodeParameter(String).
Declaration
public static string DecodeParameter(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The encoded value. |
Returns
Type | Description |
---|---|
System.String | The decoded value. |
DecryptParameter(String, String)
Decrypts an encrypted value generated via EncryptParameter(String, String).
Declaration
public static string DecryptParameter(string value, string encryptionKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The encrypted value. |
System.String | encryptionKey | The key used to encrypt the value. |
Returns
Type | Description |
---|---|
System.String | The decrypted value. |
DecryptParameter(String)
Decrypts an encrypted value generated via EncryptParameter(String). Decrypted using the current portal's GUID.
Declaration
public static string DecryptParameter(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The encrypted value. |
Returns
Type | Description |
---|---|
System.String | The decrypted value. |
EncodeParameter(String)
Encodes a value (using base64) for placing in a URL.
Declaration
public static string EncodeParameter(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to encode. |
Returns
Type | Description |
---|---|
System.String | The encoded value. |
EncryptParameter(String, String)
Encrypt a parameter for placing in a URL.
Declaration
public static string EncryptParameter(string value, string encryptionKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to encrypt. |
System.String | encryptionKey | The key to use when encrypting the value. This key must be used to decrypt the value. |
Returns
Type | Description |
---|---|
System.String | The encrypted value. |
EncryptParameter(String)
Encrypt a parameter for placing in a URL. Encrypted using the current portal's GUID.
Declaration
public static string EncryptParameter(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to encrypt. |
Returns
Type | Description |
---|---|
System.String | The encrypted value. |
GetParameterName(String)
Gets the name from a query string pair.
Declaration
public static string GetParameterName(string pair)
Parameters
Type | Name | Description |
---|---|---|
System.String | pair | The pair, e.g. |
Returns
Type | Description |
---|---|
System.String | The name. |
GetParameterValue(String)
Gets the value from a query string pair.
Declaration
public static string GetParameterValue(string pair)
Parameters
Type | Name | Description |
---|---|---|
System.String | pair | The pair, e.g. |
Returns
Type | Description |
---|---|
System.String | The value. |
GetQSParamsForNavigateURL()
getQSParamsForNavigateURL builds up a new querystring. This is necessary in order to prep for navigateUrl. we don't ever want a tabid, a ctl and a language parameter in the qs either, the portalid param is not allowed when the tab is a supertab (because NavigateUrl adds the portalId param to the qs).
Declaration
public static string[] GetQSParamsForNavigateURL()
Returns
Type | Description |
---|---|
System.String[] | The query-string parameters collection in |
Handle404Exception(HttpResponse, PortalSettings)
Redirect current response to 404 error page or output 404 content if error page not defined.
Declaration
public static void Handle404Exception(HttpResponse response, PortalSettings portalSetting)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
PortalSettings | portalSetting | The portal settings. |
InPopUp()
Determines whether the current page is being shown in a pop-up.
Declaration
public static bool InPopUp()
Returns
Type | Description |
---|---|
System.Boolean | true if the current page is in a pop-up, otherwise false. |
IsPopUp(String)
Determines whether the given URL is for a page being shown in a pop-up.
Declaration
public static bool IsPopUp(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL. |
Returns
Type | Description |
---|---|
System.Boolean | true if the URL is for a page in a pop-up, otherwise false. |
IsSecureConnectionOrSslOffload(HttpRequest)
check if connection is HTTPS or is HTTP but with ssloffload enabled on a secure page.
Declaration
public static bool IsSecureConnectionOrSslOffload(HttpRequest request)
Parameters
Type | Name | Description |
---|---|---|
HttpRequest | request | current request. |
Returns
Type | Description |
---|---|
System.Boolean | true if HTTPS or if HTTP with an SSL offload header value, false otherwise. |
IsSslOffloadEnabled(HttpRequest)
Provides utilities for dealing with DNN's URLs. Consider using
Declaration
public static bool IsSslOffloadEnabled(HttpRequest request)
Parameters
Type | Name | Description |
---|---|---|
HttpRequest | request |
Returns
Type | Description |
---|---|
System.Boolean |
OpenNewWindow(Page, Type, String)
Provides utilities for dealing with DNN's URLs. Consider using
Declaration
public static void OpenNewWindow(Page page, Type type, string url)
Parameters
Type | Name | Description |
---|---|---|
Page | page | |
Type | type | |
System.String | url |
PopUpUrl(String, Control, PortalSettings, Boolean, Boolean, Int32, Int32, Boolean, String)
Provides utilities for dealing with DNN's URLs. Consider using
Declaration
public static string PopUpUrl(string url, Control control, PortalSettings portalSettings, bool onClickEvent, bool responseRedirect, int windowHeight, int windowWidth, bool refresh, string closingUrl)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | |
Control | control | |
PortalSettings | portalSettings | |
System.Boolean | onClickEvent | |
System.Boolean | responseRedirect | |
System.Int32 | windowHeight | |
System.Int32 | windowWidth | |
System.Boolean | refresh | |
System.String | closingUrl |
Returns
Type | Description |
---|---|
System.String |
PopUpUrl(String, Control, PortalSettings, Boolean, Boolean, Int32, Int32)
Provides utilities for dealing with DNN's URLs. Consider using
Declaration
public static string PopUpUrl(string url, Control control, PortalSettings portalSettings, bool onClickEvent, bool responseRedirect, int windowHeight, int windowWidth)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | |
Control | control | |
PortalSettings | portalSettings | |
System.Boolean | onClickEvent | |
System.Boolean | responseRedirect | |
System.Int32 | windowHeight | |
System.Int32 | windowWidth |
Returns
Type | Description |
---|---|
System.String |
PopUpUrl(String, Control, PortalSettings, Boolean, Boolean)
Provides utilities for dealing with DNN's URLs. Consider using
Declaration
public static string PopUpUrl(string url, Control control, PortalSettings portalSettings, bool onClickEvent, bool responseRedirect)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | |
Control | control | |
PortalSettings | portalSettings | |
System.Boolean | onClickEvent | |
System.Boolean | responseRedirect |
Returns
Type | Description |
---|---|
System.String |
PopUpUrl(String, PortalSettings, Boolean, Boolean, Int32, Int32)
Provides utilities for dealing with DNN's URLs. Consider using
Declaration
public static string PopUpUrl(string url, PortalSettings portalSettings, bool onClickEvent, bool responseRedirect, int windowHeight, int windowWidth)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | |
PortalSettings | portalSettings | |
System.Boolean | onClickEvent | |
System.Boolean | responseRedirect | |
System.Int32 | windowHeight | |
System.Int32 | windowWidth |
Returns
Type | Description |
---|---|
System.String |
ReplaceQSParam(String, String, String)
Replaces a query string parameter's value in a URL.
Declaration
public static string ReplaceQSParam(string url, string param, string newValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL. |
System.String | param | The parameter name. |
System.String | newValue | The parameter value. |
Returns
Type | Description |
---|---|
System.String | The updated URL. |
StripQSParam(String, String)
Removes the query string parameter with the given name from the URL.
Declaration
public static string StripQSParam(string url, string param)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL. |
System.String | param | The parameter name. |
Returns
Type | Description |
---|---|
System.String | The updated URL. |
ValidReturnUrl(String)
Determines whether a url
is valid as a return URL.
Declaration
public static string ValidReturnUrl(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL string. |
Returns
Type | Description |
---|---|
System.String | The normalized return URL or |