Interface IRedirectUrlService
Provides operations for managing URL redirects for content items.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IRedirectUrlService : IService
Methods
View SourceDelete(Guid)
Deletes a redirect URL.
Declaration
[Obsolete("Use DeleteWithStatus(Guid) to support cancellation via notifications. Scheduled for removal in Umbraco 20.")]
void Delete(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | The redirect URL identifier. |
Delete(IRedirectUrl)
Deletes a redirect URL.
Declaration
[Obsolete("Use DeleteWithStatus(IRedirectUrl) to support cancellation via notifications. Scheduled for removal in Umbraco 20.")]
void Delete(IRedirectUrl redirectUrl)
Parameters
| Type | Name | Description |
|---|---|---|
| IRedirectUrl | redirectUrl | The redirect URL to delete. |
DeleteAll()
Deletes all redirect URLs.
Declaration
void DeleteAll()
DeleteContentRedirectUrls(Guid)
Deletes all redirect URLs for a given content.
Declaration
[Obsolete("Use DeleteContentRedirectUrlsWithStatus to support cancellation via notifications. Scheduled for removal in Umbraco 20.")]
void DeleteContentRedirectUrls(Guid contentKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | contentKey | The content unique key. |
DeleteContentRedirectUrlsWithStatus(Guid)
Deletes all redirect URLs for a given content, returning the operation status.
Declaration
RedirectUrlOperationStatus DeleteContentRedirectUrlsWithStatus(Guid contentKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | contentKey | The content unique key. |
Returns
| Type | Description |
|---|---|
| RedirectUrlOperationStatus | Success on success, or CancelledByNotification if a notification handler canceled the operation. |
DeleteWithStatus(Guid)
Deletes a redirect URL by its identifier, returning the operation status.
Declaration
RedirectUrlOperationStatus DeleteWithStatus(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | The redirect URL identifier. |
Returns
| Type | Description |
|---|---|
| RedirectUrlOperationStatus | Success on success, NotFound if no redirect URL with the given identifier exists, or CancelledByNotification if a notification handler canceled the operation. |
DeleteWithStatus(IRedirectUrl)
Deletes a redirect URL, returning the operation status.
Declaration
RedirectUrlOperationStatus DeleteWithStatus(IRedirectUrl redirectUrl)
Parameters
| Type | Name | Description |
|---|---|---|
| IRedirectUrl | redirectUrl | The redirect URL to delete. |
Returns
| Type | Description |
|---|---|
| RedirectUrlOperationStatus | Success on success, or CancelledByNotification if a notification handler canceled the operation. |
GetAllRedirectUrls(int, int, out long)
Gets all redirect URLs.
Declaration
IEnumerable<IRedirectUrl> GetAllRedirectUrls(int skip, int take, out long total)
Parameters
| Type | Name | Description |
|---|---|---|
| int | skip | Amount to skip. |
| int | take | Amount to take. |
| long | total | The total count of redirect URLs. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRedirectUrl> | The redirect URLs. |
GetAllRedirectUrls(int, long, int, out long)
Gets all redirect URLs below a given content item.
Declaration
IEnumerable<IRedirectUrl> GetAllRedirectUrls(int rootContentId, long pageIndex, int pageSize, out long total)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rootContentId | The content unique identifier. |
| long | pageIndex | The page index. |
| int | pageSize | The page size. |
| long | total | The total count of redirect URLs. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRedirectUrl> | The redirect URLs. |
GetAllRedirectUrls(long, int, out long)
Gets all redirect URLs.
Declaration
IEnumerable<IRedirectUrl> GetAllRedirectUrls(long pageIndex, int pageSize, out long total)
Parameters
| Type | Name | Description |
|---|---|---|
| long | pageIndex | The page index. |
| int | pageSize | The page size. |
| long | total | The total count of redirect URLs. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRedirectUrl> | The redirect URLs. |
GetContentRedirectUrls(Guid)
Gets all redirect URLs for a content item.
Declaration
IEnumerable<IRedirectUrl> GetContentRedirectUrls(Guid contentKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | contentKey | The content unique key. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRedirectUrl> | All redirect URLs for the content item. |
GetMostRecentRedirectUrl(string)
Gets the most recent redirect URLs corresponding to an Umbraco redirect URL route.
Declaration
IRedirectUrl? GetMostRecentRedirectUrl(string url)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The Umbraco redirect URL route. |
Returns
| Type | Description |
|---|---|
| IRedirectUrl | The most recent redirect URLs corresponding to the route. |
GetMostRecentRedirectUrl(string, string?)
Gets the most recent redirect URLs corresponding to an Umbraco redirect URL route.
Declaration
IRedirectUrl? GetMostRecentRedirectUrl(string url, string? culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The Umbraco redirect URL route. |
| string | culture | The culture of the request. |
Returns
| Type | Description |
|---|---|
| IRedirectUrl | The most recent redirect URLs corresponding to the route. |
GetMostRecentRedirectUrlAsync(string, string?)
Gets the most recent redirect URLs corresponding to an Umbraco redirect URL route.
Declaration
Task<IRedirectUrl?> GetMostRecentRedirectUrlAsync(string url, string? culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The Umbraco redirect URL route. |
| string | culture | The culture of the request. |
Returns
| Type | Description |
|---|---|
| Task<IRedirectUrl> | The most recent redirect URLs corresponding to the route. |
Register(string, Guid, string?)
Registers a redirect URL.
Declaration
[Obsolete("Use RegisterWithStatus to support cancellation via notifications. Scheduled for removal in Umbraco 20.")]
void Register(string url, Guid contentKey, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The Umbraco URL route. |
| Guid | contentKey | The content unique key. |
| string | culture | The culture. |
Remarks
Is a proper Umbraco route eg /path/to/foo or 123/path/tofoo.
RegisterWithStatus(string, Guid, string?)
Registers a redirect URL.
Declaration
Attempt<IRedirectUrl?, RedirectUrlOperationStatus> RegisterWithStatus(string oldUrl, Guid contentKey, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldUrl | The previous Umbraco URL route the redirect is being created from. |
| Guid | contentKey | The content unique key. |
| string | culture | The culture. |
Returns
| Type | Description |
|---|---|
| Attempt<IRedirectUrl, RedirectUrlOperationStatus> | An Attempt<TResult, TStatus> containing the registered redirect URL on success, or CancelledByNotification if a notification handler canceled the operation. |
SearchRedirectUrls(string, int, int, out long)
Searches for all redirect URLs that contain a given search term in their URL property.
Declaration
IEnumerable<IRedirectUrl> SearchRedirectUrls(string searchTerm, int skip, int take, out long total)
Parameters
| Type | Name | Description |
|---|---|---|
| string | searchTerm | The term to search for. |
| int | skip | Amount to skip. |
| int | take | Amount to take. |
| long | total | The total count of redirect URLs. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRedirectUrl> | The redirect URLs. |
SearchRedirectUrls(string, long, int, out long)
Searches for all redirect URLs that contain a given search term in their URL property.
Declaration
IEnumerable<IRedirectUrl> SearchRedirectUrls(string searchTerm, long pageIndex, int pageSize, out long total)
Parameters
| Type | Name | Description |
|---|---|---|
| string | searchTerm | The term to search for. |
| long | pageIndex | The page index. |
| int | pageSize | The page size. |
| long | total | The total count of redirect URLs. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRedirectUrl> | The redirect URLs. |