Class UrlHelper
Class to assist working with URLs.
Inherited Members
Namespace: SuperOffice.Util
Assembly: SoCore.dll
Syntax
public static class UrlHelper
Methods
Combine(string, string, bool)
Safely appends one URL-segment on to another. This involves validating the individual URL parts and possibly throwing on invalid data or combinations of parts.
Declaration
public static string Combine(string baseUrl, string suffix, bool allowUnrooted = false)
Parameters
Type | Name | Description |
---|---|---|
string | baseUrl | Must be an absolute path, unless allowUnrooted is set true. |
string | suffix | Cannot be an absolute path. |
bool | allowUnrooted |
Returns
Type | Description |
---|---|
string |
ResolveApplicationRoot(string)
Try to resolve a the application-root url based on a pre-provided URL stem which may or may not contain noise.
Example of usage is asking user for URL to the CRM website. The user will typically copy paste from the browser: http://server.com/virtualdir/default.aspx?lotsOfParameters
They may copy things from config-files http://server.com/virtualdir/remote/Services75
Or the link may actually be correctly formatted: http://server.com/virtualdir/
From any of these inputs we want to be able find the appliaction root.
Declaration
public static string ResolveApplicationRoot(string providedUrl)
Parameters
Type | Name | Description |
---|---|---|
string | providedUrl |
Returns
Type | Description |
---|---|
string |
ResolveServiceUrl(string, string)
Resolve the location of a service based on a URL which represents a part of the current application, and which may contains "noise".
Declaration
public static string ResolveServiceUrl(string providedUrl, string serviceSuffix)
Parameters
Type | Name | Description |
---|---|---|
string | providedUrl | URL which may or may not contain noise. |
string | serviceSuffix | Service-suffix from application-root. |
Returns
Type | Description |
---|---|
string |